Skip to content

Fix #23#24

Merged
tenntenn merged 4 commits intomainfrom
fix-23-tool-directive
Mar 19, 2025
Merged

Fix #23#24
tenntenn merged 4 commits intomainfrom
fix-23-tool-directive

Conversation

@tenntenn
Copy link
Member

@tenntenn tenntenn commented Mar 18, 2025

What

  • Remove tool directives from the copy of go.mod before go mod tidy in Go1.24 and later.

Why

@tenntenn tenntenn force-pushed the fix-23-tool-directive branch 3 times, most recently from 147a7d1 to 9b237ff Compare March 18, 2025 23:01
@tenntenn tenntenn force-pushed the fix-23-tool-directive branch from 9b237ff to 4f7d60e Compare March 18, 2025 23:15
go vet ./...
go vet -vettool=$(pwd)/tennvet ./...
go test -v -race ./...
- name: Checkout code
Copy link
Member Author

Choose a reason for hiding this comment

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

The go.mod specifies 1.23.7 as go directive but this PR chages for Go1.24 environment. Then the go.mod specifies 1.24.1 as toolchain directive.

Because tennvet checks whether use feature Go version build constraint, Install Go with toolchain directive version.

pre_go124.go Outdated
// This function does nothing.
// Because go.mod does not have a tool directive until Go1.24.
func removeToolDirective(tb testing.TB) {
t.Helper()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since the parameter is named tb, it would be appropriate to use tb.Helper() instead of t.Helper().

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh...


"golang.org/x/tools/go/analysis/analysistest"

"github.com/tenntenn/golden"
Copy link
Collaborator

@Arupaka1152 Arupaka1152 Mar 19, 2025

Choose a reason for hiding this comment

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

I noticed that the golden module is directly imported in this file, but it's listed as an indirect dependency in the go.mod file. Is this intentional?

@tenntenn tenntenn force-pushed the fix-23-tool-directive branch 2 times, most recently from 923f0f7 to b338990 Compare March 19, 2025 01:02
@tenntenn tenntenn force-pushed the fix-23-tool-directive branch from b338990 to 1845db6 Compare March 19, 2025 01:04
@tenntenn tenntenn requested a review from Arupaka1152 March 19, 2025 01:08
Copy link
Collaborator

@Arupaka1152 Arupaka1152 left a comment

Choose a reason for hiding this comment

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

LGTM!!

@tenntenn tenntenn merged commit 5fdfff9 into main Mar 19, 2025
2 checks passed
@tenntenn tenntenn deleted the fix-23-tool-directive branch March 19, 2025 02:47
@github-actions github-actions bot mentioned this pull request Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent dependency traversal caused by tool directives in Go 1.24

2 participants