Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to solve "stderr: go mod tidy: go.mod file indicates go 1.17, but maximum supported version is 1.16 ." error?

I am getting error on Visual Studio Code:

Command 'gopls.tidy' failed: Error: err: exit status 1: stderr: go mod tidy: go.mod file indicates go 1.17, but maximum supported version is 1.16 .

I can't fix it with go mod tidy and go mod init. How can I solve this?

like image 477
srls01 Avatar asked Aug 30 '25 16:08

srls01


2 Answers

A simple command in the terminal helped me:

brew upgrade go

GoLang has been updated, I have restarted the project, and everything is working

like image 144
Sergei Avatar answered Sep 04 '25 02:09

Sergei


If you are using IntelliJ or GoLand built-in terminal, change GOROOT on this page:

screenshot

then restart the IDE.

like image 21
Kokizzu Avatar answered Sep 04 '25 04:09

Kokizzu