为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

huangapple go评论89阅读模式
英文:

Why when I move file %GOROOT%\tour.exe to foo\tour.exe , Go tour cannot run?

问题

  1. 我阅读了https://go.dev/tour/welcome/3。

  2. 我的环境

Microsoft Windows [版本 10.0.22621.1265]
(c) Microsoft Corporation。保留所有权利。

C:\Users\donhu>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\donhu\AppData\Local\go-build
set GOENV=C:\Users\donhu\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\donhu\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\donhu\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.20.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\donhu\AppData\Local\Temp\go-build1095406662=/tmp/go-build -gno-record-gcc-switches

C:\Users\donhu>
  1. 我运行CMD,
go install golang.org/x/website/tour@latest

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

我有

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

我运行C:\Users\donhu\go\bin\tour.exe没问题

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

英文:
  1. I read https://go.dev/tour/welcome/3

  2. My environment

Microsoft Windows [Version 10.0.22621.1265]
(c) Microsoft Corporation. All rights reserved.

C:\Users\donhu>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\donhu\AppData\Local\go-build
set GOENV=C:\Users\donhu\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\donhu\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\donhu\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.20.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\donhu\AppData\Local\Temp\go-build1095406662=/tmp/go-build -gno-record-gcc-switches

C:\Users\donhu>
  1. I run CMD,
go install golang.org/x/website/tour@latest

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

I have

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

I run C:\Users\donhu\go\bin\tour.exe ok

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

为什么当我将文件%GOROOT%\tour.exe移动到foo\tour.exe时,Go tour无法运行?

Why when I move file %GOROOT%\tour.exe to foo\tour.exe , Go tour cannot run?

答案1

得分: 0

因为端口3999已被占用。

http://127.0.0.1:3999/welcome/1

tour.exe可以在任何文件夹中独立运行。

英文:

Because port 3999 is in use.

http://127.0.0.1:3999/welcome/1

tour.exe can run standalone at every folder.

huangapple
  • 本文由 发表于 2023年3月3日 20:45:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627252.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定