Skip to content

Update to go 1.26.0 and golangci-lint 2.9.0#36588

Merged
techknowlogick merged 8 commits into
go-gitea:mainfrom
silverwind:go126
Feb 11, 2026
Merged

Update to go 1.26.0 and golangci-lint 2.9.0#36588
techknowlogick merged 8 commits into
go-gitea:mainfrom
silverwind:go126

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Feb 11, 2026

Code fixes were done autmatically, followed by manual removal of unused functions.

xgo should be ready as per techknowlogick/xgo#301.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 11, 2026
silverwind and others added 5 commits February 11, 2026 15:23
Go 1.26 extends the new() builtin to accept values, making the
ToPointer helper redundant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread go.mod
go 1.25.0

toolchain go1.25.7
go 1.26.0
Copy link
Copy Markdown
Member Author

@silverwind silverwind Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently go mod tidy gets rid of the toolchain directive when it matches the minimum go version because go considers it "redundant". We have to keep in mind to restore the directive for 1.26.1 so that govulncheck can target it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

golang issue about this: golang/go#75331

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 11, 2026
silverwind and others added 2 commits February 11, 2026 15:45
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@silverwind silverwind changed the title Update to go 1.26 and golangci-lint 2.9.0 Update to go 1.26.0 and golangci-lint 2.9.0 Feb 11, 2026
@lunny
Copy link
Copy Markdown
Member

lunny commented Feb 11, 2026

Note that new creates a copy of the content and allocates a new variable.
This means it is slightly slower and uses more memory compared to ToPointer.

That said, I’m not opposed to the change: it makes the code noticeably simpler and cleaner, and the performance difference is only in the nanosecond range, which is negligible in almost all practical cases.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 11, 2026
@techknowlogick techknowlogick merged commit 45ee571 into go-gitea:main Feb 11, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Feb 11, 2026
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Feb 11, 2026

Note that new creates a copy of the content and allocates a new variable. This means it is slightly slower and uses more memory compared to ToPointer.

That said, I’m not opposed to the change: it makes the code noticeably simpler and cleaner, and the performance difference is only in the nanosecond range, which is negligible in almost all practical cases.

I agree it'll probably not be a performance bottleneck. And it's better to follow these suggestions as it will become popular and popular techniques are bound to get more optimization attention over time.

@silverwind silverwind deleted the go126 branch February 11, 2026 17:46
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 12, 2026
* origin/main: (34 commits)
  Fine tune diff highlighting (go-gitea#36592)
  Add code editor setting dropdowns (go-gitea#36534)
  Update to go 1.26.0 and golangci-lint 2.9.0 (go-gitea#36588)
  Improve diff highlighting (go-gitea#36583)
  Fix markup code block layout (go-gitea#36578)
  Remove striped tables in UI (go-gitea#36509)
  Fix vertical alignment of `.commit-sign-badge` children (go-gitea#36570)
  Fix mirror sync parser and fix mirror messages (go-gitea#36504)
  Update JS and PY deps (go-gitea#36576)
  Add viewer controller for mermaid (zoom, drag) (go-gitea#36557)
  Misc typescript tweaks (go-gitea#36523)
  Use full-file highlighting for diff sections (go-gitea#36561)
  fix(diff): reprocess htmx content after loading more files (go-gitea#36568)
  [skip ci] Updated translations via Crowdin
  Add wrap to runner label list (go-gitea#36565)
  fix: add dnf5 command for Fedora in RPM package instructions (go-gitea#36527)
  Enable pagination on GiteaDownloader.getIssueReactions() (go-gitea#36549)
  Refactor merge conan and container auth preserve actions taskID (go-gitea#36560)
  Fix assignee sidebar links and empty placeholder after go-gitea#32465 refactor (go-gitea#36559)
  Fix various version parsing problems (go-gitea#36553)
  ...
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 12, 2026
* origin/main: (152 commits)
  Fine tune diff highlighting (go-gitea#36592)
  Add code editor setting dropdowns (go-gitea#36534)
  Update to go 1.26.0 and golangci-lint 2.9.0 (go-gitea#36588)
  Improve diff highlighting (go-gitea#36583)
  Fix markup code block layout (go-gitea#36578)
  Remove striped tables in UI (go-gitea#36509)
  Fix vertical alignment of `.commit-sign-badge` children (go-gitea#36570)
  Fix mirror sync parser and fix mirror messages (go-gitea#36504)
  Update JS and PY deps (go-gitea#36576)
  Add viewer controller for mermaid (zoom, drag) (go-gitea#36557)
  Misc typescript tweaks (go-gitea#36523)
  Use full-file highlighting for diff sections (go-gitea#36561)
  fix(diff): reprocess htmx content after loading more files (go-gitea#36568)
  [skip ci] Updated translations via Crowdin
  Add wrap to runner label list (go-gitea#36565)
  fix: add dnf5 command for Fedora in RPM package instructions (go-gitea#36527)
  Enable pagination on GiteaDownloader.getIssueReactions() (go-gitea#36549)
  Refactor merge conan and container auth preserve actions taskID (go-gitea#36560)
  Fix assignee sidebar links and empty placeholder after go-gitea#32465 refactor (go-gitea#36559)
  Fix various version parsing problems (go-gitea#36553)
  ...
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 14, 2026
* origin/main: (2555 commits)
  automate updating nix flakes (go-gitea#35641)
  Update AGENTS.md instructions (go-gitea#36627)
  use user id in noreply emails (go-gitea#36550)
  feat(db): Improve BuildCaseInsensitiveLike with lowercase (go-gitea#36598)
  [skip ci] Updated translations via Crowdin
  BUG: Fix workflow run jobs API returning null steps (go-gitea#36603)
  Refactor highlight and diff (go-gitea#36599)
  Fix bug when do LFS GC (go-gitea#36500)
  feature to be able to filter project boards by milestones (go-gitea#36321)
  Update emoji data for Unicode 16 (go-gitea#36596)
  Adapt monaco error matching pattern to recent webpack config change (go-gitea#36533)
  Fix a bug user could change another user's primary email (go-gitea#36586)
  fix(repo-editor): disable Monaco `editContext` to avoid bugs with lost focus (go-gitea#36585)
  Fine tune diff highlighting (go-gitea#36592)
  Add code editor setting dropdowns (go-gitea#36534)
  Update to go 1.26.0 and golangci-lint 2.9.0 (go-gitea#36588)
  Improve diff highlighting (go-gitea#36583)
  Fix markup code block layout (go-gitea#36578)
  Remove striped tables in UI (go-gitea#36509)
  Fix vertical alignment of `.commit-sign-badge` children (go-gitea#36570)
  ...

# Conflicts:
#	custom/conf/app.example.ini
#	docs/content/administration/config-cheat-sheet.en-us.md
#	docs/content/administration/config-cheat-sheet.zh-cn.md
#	modules/setting/security.go
#	routers/common/errpage.go
#	services/context/api.go
#	services/context/context.go
Sirherobrine23 pushed a commit to Sirherobrine23/gitea that referenced this pull request Mar 4, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

Note that new creates a copy of the content and allocates a new variable. This means it is slightly slower and uses more memory compared to ToPointer.

That said, I’m not opposed to the change: it makes the code noticeably simpler and cleaner, and the performance difference is only in the nanosecond range, which is negligible in almost all practical cases.

No, it's not true.

ToPointer also makes a copy and allocates a new variable. There is no difference.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants