Skip to content

Conversation

@echoface
Copy link

minor version declaration cause problem when user go mod tidy;
it will downgrade or change user's toolchain instruction and mess up dependencies

@sagikazarmark sagikazarmark requested a review from Copilot July 16, 2025 05:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a Go module dependency issue by removing the patch version from the Go version directive in go.mod. The change prevents go mod tidy from potentially downgrading or changing users' toolchain instructions.

  • Updates Go version directive from 1.21.0 to 1.21 to follow Go module best practices

module github.com/spf13/cast

go 1.21.0
go 1.21
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

Good fix! The Go version directive in go.mod should specify only major.minor versions (e.g., 1.21) rather than including patch versions (e.g., 1.21.0). This follows Go module best practices and prevents toolchain version conflicts during 'go mod tidy' operations.

Copilot uses AI. Check for mistakes.
@echoface
Copy link
Author

@spf13 @sagikazarmark please review ,thanks

@sagikazarmark
Copy link
Collaborator

I'm not entirely sure why this is necessary.

As of Go 1.21, that's the correct notation: https://go.dev/doc/go1.21#tools

(In fact, as of Go 1.23 it's the only accepted notation)

It declares a minimum required version, so as longs you have something later in your toolchain, it shouldn't cause any issues.

Can you please show me an example where it causes trouble? Thanks!

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.

2 participants