[PR #619] [MERGED] Use strings.Cut to simplify logic #1529

Closed
opened 2025-12-29 02:30:26 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/619
Author: @majst01
Created: 6/8/2022
Status: Merged
Merged: 6/9/2022
Merged by: @juanfont

Base: mainHead: simplify-split


📝 Commits (1)

  • 86ce0e0 Use strings.Cut to simplify logic

📊 Changes

1 file changed (+3 additions, -13 deletions)

View changed files

📝 api_key.go (+3 -13)

📄 Description

One of the glory enhancements of go-1.18 was the introduction of strings.Cut which reduces the burden of counting the length of the result slice, also makes code much more readable in such cases where only two results are expected.

  • read the CONTRIBUTING guidelines
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

🔄 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/juanfont/headscale/pull/619 **Author:** [@majst01](https://github.com/majst01) **Created:** 6/8/2022 **Status:** ✅ Merged **Merged:** 6/9/2022 **Merged by:** [@juanfont](https://github.com/juanfont) **Base:** `main` ← **Head:** `simplify-split` --- ### 📝 Commits (1) - [`86ce0e0`](https://github.com/juanfont/headscale/commit/86ce0e0c66ac7e6b57a8ee43aa151d759b1c01cb) Use strings.Cut to simplify logic ### 📊 Changes **1 file changed** (+3 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `api_key.go` (+3 -13) </details> ### 📄 Description One of the glory enhancements of go-1.18 was the introduction of `strings.Cut` which reduces the burden of counting the length of the result slice, also makes code much more readable in such cases where only two results are expected. - [x] read the [CONTRIBUTING guidelines](README.md#contributing) - [ ] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [ ] updated CHANGELOG.md <!-- If applicable, please reference the issue using `Fixes #XXX` and add tests to cover your new code. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 02:30:26 +01:00
adam closed this issue 2025-12-29 02:30:26 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1529