Movatterモバイル変換


[0]ホーム

URL:


Managing Go installations

This topic describes how to install multiple versions of Go on the same machine, as well as how to uninstall Go.

For other content on installing, you might be interested in:

Installing multiple Go versions

You can install multiple Go versions on the same machine. For example, you might want to test your code on multiple Go versions. For a list of versions you can install this way, see thedownload page.

Note: To install using the method described here, you'll need to havegit installed.

To install additional Go versions, run thego install command, specifying the download location of the version you want to install. The following example illustrates with version 1.10.7:

$ go install golang.org/dl/go1.10.7@latest$ go1.10.7 download

To rungo commands with the newly-downloaded version, append the version number to thego command, as follows:

$ go1.10.7 versiongo version go1.10.7 linux/amd64

When you have multiple versions installed, you can discover where each is installed, look at the version'sGOROOT value. For example, run a command such as the following:

$ go1.10.7 env GOROOT

To uninstall a downloaded version, just remove the directory specified by itsGOROOT environment variable and the goX.Y.Z binary.

Uninstalling Go

You can remove Go from your system using the steps described in this topic.

Removing user config and data

Go stores user configuration in thego directory within the user configuration directory,as returned byos.UserConfigDir.This can also be found as the directory containing the config file returned bygo env GOENV.

Go stores intermediate build artifacts in the directory returned bygo env GOCACHE.These can be removed withgo clean -cache.

Go stores downloaded dependencies in the directory returned bygo env GOMODCACHE.These can be removed withgo clean -modcache.

Linux / macOS / FreeBSD

  1. Delete the go directory.

    This is usually /usr/local/go.

  2. Remove the Go bin directory from yourPATH environment variable.

    Under Linux and FreeBSD, edit /etc/profile or $HOME/.profile. If you installed Go with the macOS package, remove the /etc/paths.d/go file.

Windows

The simplest way to remove Go is via Add/Remove Programs in the Windows control panel:

  1. In Control Panel, double-clickAdd/Remove Programs.
  2. InAdd/Remove Programs, selectGo Programming Language, click Uninstall, then follow the prompts.

For removing Go with tools, you can also use the command line:

go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp