Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc/tutorial/call-module-code: recap the directory structure from the previous step? #41573

Open
bcetienne opened this issue Sep 23, 2020 · 5 comments

Comments

@bcetienne
Copy link

@bcetienne bcetienne commented Sep 23, 2020

What version of Go are you using (go version)?

$ go version go1.15.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/etienne/Library/Caches/go-build"
GOENV="/Users/etienne/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/etienne/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/etienne/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/etienne/Desktop/greetings/hello/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sb/6q_vnpy53xn95mr4kj7h9lvc0000gq/T/go-build921607341=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I followed the guidelines for learning Go on the official website.
I first did this part which is not a problem (https://golang.org/doc/tutorial/create-module) but in the second part (https://golang.org/doc/tutorial/call-module-code), the build command from the hello directory doesn't work.

I tried again just copying and pasting the provided code but nothing changes.

Here is my go.mod file in the hello directory.

module hello

go 1.15

replace example.com/greetings => ../greetings

Here is my structure

image

What did you expect to see?

$ go build
go: found example.com/greetings in example.com/greetings v0.0.0-00010101000000-000000000000


What did you see instead?

$ go build
hello.go:6:2: example.com/greetings@v0.0.0-00010101000000-000000000000: replacement directory ../greetings does not exist

@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Sep 23, 2020

going up from hello ../ you're in the greetings directory, then you try to go down a level into a directory that does not exist greetings

see https://github.com/golang/go/wiki/Questions for the appropriate places to ask questions

@bcmills bcmills changed the title Go (v.1.15.2) build - Replacement directory does not exist doc/tutorial/call-module-code: recap the directory structure from the previous step? Sep 23, 2020
@bcmills
Copy link
Member

@bcmills bcmills commented Sep 23, 2020

The go command is working as designed here, but that tutorial is fairly new — perhaps it could be adjusted to make this sort of mistake less likely.

(CC @stevetraut)

@bcmills bcmills added this to the Unreleased milestone Sep 23, 2020
@stevetraut stevetraut self-assigned this Sep 23, 2020
@stevetraut
Copy link

@stevetraut stevetraut commented Sep 23, 2020

Thanks, folks. I'll take a look.

@stevetraut
Copy link

@stevetraut stevetraut commented Sep 23, 2020

Hm. Step one in https://golang.org/doc/tutorial/call-module-code has the following, which is intended to cd up from where you were in the preceding topic (greetings) and create a hello directory at the same level as greetings. Maybe that first step needs to reestablish context from the preceding topic.

cd ..
mkdir hello
cd hello
@bcetienne
Copy link
Author

@bcetienne bcetienne commented Sep 23, 2020

Hi everyone, thank you for taking the time to read my concern.
For more precision, I really followed the tutorial step by step and I executed the build command from the greetings/hello directory (the return I put in my original message), seeing that it didn't work I also tried (out of curiosity) from the root folder but as I imagined it didn't work any more.

I don't know if this helps you any more...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants