[PR #1183] [MERGED] Reimplement isValidAccessToken without reflect package #13385

Closed
opened 2026-08-05 02:08:16 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1183
Author: @surik
Created: 9/28/2023
Status: Merged
Merged: 9/28/2023
Merged by: @braginini

Base: mainHead: yury/get-rid-reflect


📝 Commits (1)

  • 245b6e1 Reimplement isValidAccessToken without reflect

📊 Changes

1 file changed (+6 additions, -8 deletions)

View changed files

📝 client/internal/auth/util.go (+6 -8)

📄 Description

The use of reflection should generally be minimized in Go code because it can make the code less readable, less type-safe, and potentially slower.

In this particular case we can simply rely on type switch.

Describe your changes

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/1183 **Author:** [@surik](https://github.com/surik) **Created:** 9/28/2023 **Status:** ✅ Merged **Merged:** 9/28/2023 **Merged by:** [@braginini](https://github.com/braginini) **Base:** `main` ← **Head:** `yury/get-rid-reflect` --- ### 📝 Commits (1) - [`245b6e1`](https://github.com/netbirdio/netbird/commit/245b6e1ec2bf0c0de01fff92e1392b3c215ad3f3) Reimplement isValidAccessToken without reflect ### 📊 Changes **1 file changed** (+6 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/auth/util.go` (+6 -8) </details> ### 📄 Description The use of reflection should generally be minimized in Go code because it can make the code less readable, less type-safe, and potentially slower. In this particular case we can simply rely on type switch. ## Describe your changes ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 02:08:16 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#13385