GolangTraining icon indicating copy to clipboard operation
GolangTraining copied to clipboard

unable to download course material in GOPATH

Open puneet336 opened this issue 1 year ago • 1 comments

I am using centos 7.

[puneets@server1]~/MyWork/experiments/exp2>export GOPATH=$PWD/
[puneets@server1]~/MyWork/experiments/exp2>ls
[puneets@server1]~/MyWork/experiments/exp2>
[puneets@server1]~/MyWork/experiments/exp2>
[puneets@server1]~/MyWork/experiments/exp2>mkdir bin src pkg
[puneets@server1]~/MyWork/experiments/exp2>ls
bin  pkg  src
[puneets@server1]~/MyWork/experiments/exp2>go get -d github.com/GoesToEleven/GolangTraining/...
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
[puneets@server1]~/MyWork/experiments/exp2>go mod init github.com/test
go: creating new go.mod: module github.com/test
go: to add module requirements and sums:
        go mod tidy
[puneets@server1]~/MyWork/experiments/exp2>go get -d github.com/GoesToEleven/GolangTraining/...
$GOPATH/go.mod exists but should not

Why GO is not allowing me download course material in workspace? Did i miss anything here? Is there a way to download course material in $PWD or $GOPATH ?

puneet336 avatar Feb 28 '23 17:02 puneet336

You have to first do go init "GitHub.com/username/anything" before you can use go get

joelket23 avatar Mar 29 '23 03:03 joelket23