Maison > Article > développement back-end > Pourquoi mon code Go génère-t-il une erreur « go1.9 ne correspond pas à go1.9.1 » ?
When attempting to run a sample code for "helloworld," you encountered the following error:
compile: version "go1.9" does not match go tool version "go1.9.1"
This error indicates a discrepancy between the version specified in your code ("go1.9") and the version of the Go tool installed on your system ("go1.9.1").
If you installed Go using Homebrew on macOS, you may need to set the $GOROOT environment variable in your shell configuration file (e.g., .bashrc or .zshrc). To do this, add the following line:
export GOROOT=/usr/local/opt/go/libexec
Even if you have not previously set $GOROOT, it may still be necessary after updating from Go 1.9 to 1.9.1. This could be a potential issue with the update process.
Alternatively, you can specify the correct Go version in your code by modifying the go line in your script to:
#!/usr/bin/env go1.9.1
This will ensure that the script uses the correct version of the Go tool.
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!