I followed the instructions for building caddy:
export GO111MODULE=on
mkdir caddy
cd caddy
.go
file:package main
import (
"github.com/caddyserver/caddy/caddy/caddymain"
// plug in plugins here, for example:
// _ "import/path/here"
)
func main() {
// optional: disable telemetry
// caddymain.EnableTelemetry = false
caddymain.Run()
}
go mod init caddy
go get github.com/caddyserver/caddy
go build
This is the result:
go: finding github.com/mholt/caddy/caddy/caddymain latest
go: finding github.com/mholt/caddy/caddy latest
go: github.com/mholt/[email protected]: parsing go.mod: unexpected module path "github.com/caddyserver/caddy"
go: error loading module requirements
Arch Linux, go version go1.12.8 linux/amd64
I just successfully followed these same steps in an alpine linux Docker image. What is your .go
file named? It should have a name like main.go
, not just .go
. That's the only thing I see different about what you're doing. The directory should also not be in the caddy source tree. Not sure where you've created it.
I just successfully followed these same steps in an alpine linux Docker image. What is your
.go
file named? It should have a name likemain.go
, not just.go
. That's the only thing I see different about what you're doing. The directory should also not be in the caddy source tree. Not sure where you've created it.
Oh my god, that was exactly it. I guess I didn't read carefully enough. Thanks. I'm not familiar with go so I thought .go
was the standard config file name or something.
Ah, wow. Glad you figured that out. :)
The docs say (emphasis added):
create a Go file (_extension_
.go
)
Sorry if that wasn't clear. It's a file extension, not a file name.
Most helpful comment
I just successfully followed these same steps in an alpine linux Docker image. What is your
.go
file named? It should have a name likemain.go
, not just.go
. That's the only thing I see different about what you're doing. The directory should also not be in the caddy source tree. Not sure where you've created it.