Structure of project
As a Go language novice I have two "dummy" questions regarding the structure of the project.
-
I would expect that I can run the
go build
command in the root directory of the project (and get the binary as a result in the same directory). However if I do so, I get an error along the lines ofcan't load package: package .: no Go files in ...
. Obviously the error is caused by the absence of a Go file in the root dir. To that effect the same doesn't apply when running the command in themain/
subdirectory where the main Go files reside. But this feels for me, as a person used to other build tools, as rather "awkward". What is your intention to not place the main package in the root directory? -
If I try to fetch the dependencies in the
main
directory, the commands exits with an error:
GIT_TERMINAL_PROMPT=1 go get
Username for 'https://gitlab.switch.ch': sschuepbach
Password for 'https://sschuepbach@gitlab.switch.ch':
# cd .; git clone -- https://gitlab.switch.ch/memoriav/memobase-2020.git /home/seb/.go/src/gitlab.switch.ch/memoriav/memobase-2020
Cloning into '/home/seb/.go/src/gitlab.switch.ch/memoriav/memobase-2020'...
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.switch.ch/memoriav/memobase-2020.git/' not found
package gitlab.switch.ch/memoriav/memobase-2020/streaming-server/memostream: exit status 128
How can I get around this error - especially in the light of building the project in the CI process, which doesn't allow for interactivity? Wouldn't it be possible to use relative paths here (after setting the GOPATH
variable), or choose the Go module approach?
Maybe it would help if you document in the README how you build the project.
Thanks in advance!