首頁  >  文章  >  後端開發  >  為什麼當我將檔案 %GOROOT%\tour.exe 移到 foo\tour.exe 時,Gotour 無法運作?

為什麼當我將檔案 %GOROOT%\tour.exe 移到 foo\tour.exe 時,Gotour 無法運作?

WBOY
WBOY轉載
2024-02-06 09:30:04867瀏覽

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

問題內容

  1. 我讀了 https://go.dev/tour/welcome/3

  2. 我的環境

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. 我運行 cmd,
go install golang.org/x/website/tour@latest

我有

我運行 c:\users\donhu\go\bin\tour.exe ok

#

為什麼當我將檔案 %goroot%\tour.exe 移到 foo\tour.exe 時,gotour 無法運作?


正確答案


因為連接埠3999正在使用中。

https://www.php.cn/link/c0a3eab00393c89313e8109bb6504a68

tour.exe 可以在每個資料夾中獨立運作。

以上是為什麼當我將檔案 %GOROOT%\tour.exe 移到 foo\tour.exe 時,Gotour 無法運作?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:stackoverflow.com。如有侵權,請聯絡admin@php.cn刪除