incu6us / goimports-reviser

Right imports sorting & code formatting tool (goimports alternative)
MIT License
607 stars 72 forks source link

go.mod toolchain error #134

Closed ozkansen closed 1 year ago

ozkansen commented 1 year ago

Hi everyone, i got go 1.21 toolchain error.

go.mod file

module example

go 1.21

toolchain go1.21.0

error detail:

goimports-reviser -rm-unused -format ./...

output:

go.mod:5: unknown directive: toolchain
james-d-elliott commented 1 year ago

How do you get this directive into the go mod using the standard tooling? It doesn't appear it's a documented directive for go.mod, only for go.work.

james-d-elliott commented 1 year ago

Ah looks like go get toolchain adds it. Unusual for a lack of docs.

ozkansen commented 1 year ago

When I updated the base go version in the project with go mod tidy -go=1.21, it added it automatically.

ozkansen commented 1 year ago

The error appears to be caused by the golang.org/x/mod package. I made the necessary updates and the problem was fixed.

incu6us commented 1 year ago

thanks @ozkansen could you fix issues in your PR to pass the pipeline?

incu6us commented 1 year ago

thanks @ozkansen now issue is fixed