[PR #1069] [MERGED] Improve account copying #13280

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

📋 Pull Request Information

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

Base: mainHead: improve-account-copying


📝 Commits (1)

📊 Changes

11 files changed (+88 additions, -30 deletions)

View changed files

📝 dns/nameserver.go (+10 -4)
📝 management/server/account_test.go (+29 -5)
📝 management/server/group.go (+4 -2)
📝 management/server/http/nameservers_handler_test.go (+1 -0)
📝 management/server/peer.go (+6 -2)
📝 management/server/personal_access_token.go (+12 -0)
📝 management/server/policy.go (+11 -6)
📝 management/server/rule.go (+6 -3)
📝 management/server/setupkey.go (+2 -2)
📝 management/server/user.go (+1 -3)
📝 route/route.go (+6 -3)

📄 Description

With this fix, all nested slices and pointers will be copied by value.
Also, this fixes tests to compare the original and copy account by their values by marshaling them to JSON strings.

Before that, they were copying the pointers that also passed the simple = compassion (as the addresses match).

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/1069 **Author:** [@surik](https://github.com/surik) **Created:** 8/9/2023 **Status:** ✅ Merged **Merged:** 8/22/2023 **Merged by:** [@braginini](https://github.com/braginini) **Base:** `main` ← **Head:** `improve-account-copying` --- ### 📝 Commits (1) - [`543055d`](https://github.com/netbirdio/netbird/commit/543055de8e9b0a4b28e8f2987d2fbdef5877349d) Improve account copying ### 📊 Changes **11 files changed** (+88 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `dns/nameserver.go` (+10 -4) 📝 `management/server/account_test.go` (+29 -5) 📝 `management/server/group.go` (+4 -2) 📝 `management/server/http/nameservers_handler_test.go` (+1 -0) 📝 `management/server/peer.go` (+6 -2) 📝 `management/server/personal_access_token.go` (+12 -0) 📝 `management/server/policy.go` (+11 -6) 📝 `management/server/rule.go` (+6 -3) 📝 `management/server/setupkey.go` (+2 -2) 📝 `management/server/user.go` (+1 -3) 📝 `route/route.go` (+6 -3) </details> ### 📄 Description With this fix, all nested slices and pointers will be copied by value. Also, this fixes tests to compare the original and copy account by their values by marshaling them to JSON strings. Before that, they were copying the pointers that also passed the simple `=` compassion (as the addresses match). ## Describe your changes ## Issue ticket number and link ### Checklist - [x] 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 --- <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:07:59 -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#13280