XCaddy Error - go list -m: not using modules

1. Caddy version (v2.3.0):

2. How I run Caddy:

a. System environment:

Ubuntu 20.04

b. Command:

xcaddy list-modules

or like xcaddy commands.

3. The problem I’m having:

Golang version: 1.15.6
GCC version: 9.3.0
XCaddy build success but xcaddy commands not working.

4. Error messages and/or full log output:

go list -m: not using modules
2021/01/21 02:00:24 [ERROR] exec [go list -m]: exit status 1:

5. What I already tried:

I added GOPATH, GOROOT environments. I installed it according to the XCaddy document.

6. Links to relevant resources:

Make sure you’ve initialized the current directory as a Go module (there should be a valid go.mod file).

Yes I create now. But not showing modules.

module github.com/caddyserver/xcaddy/cmd/xcaddy

go 1.15

require (
	github.com/Masterminds/semver/v3 v3.1.1 // indirect
	github.com/caddyserver/xcaddy v0.1.7 // indirect
xcaddy list-modules

Response like this:

2021/01/21 02:21:51 [INFO] Temporary folder: /tmp/buildenv_2021-01-21-0221.217691415
2021/01/21 02:21:51 [INFO] Writing main module: /tmp/buildenv_2021-01-21-0221.217691415/main.go
2021/01/21 02:21:51 [INFO] Initializing Go module
2021/01/21 02:21:51 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy
go: creating new go.mod: module caddy
2021/01/21 02:21:51 [INFO] Replace github.com/caddyserver/xcaddy/cmd/xcaddy => /root
2021/01/21 02:21:51 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod edit -replace github.com/caddyserver/xcaddy/cmd/xcaddy=/root
2021/01/21 02:21:51 [INFO] Pinning versions
2021/01/21 02:21:51 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.3.0
2021/01/21 02:21:53 [INFO] Build environment ready
2021/01/21 02:21:53 [INFO] Building Caddy
2021/01/21 02:21:53 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /root/caddy -ldflags -w -s -trimpath
go: finding module for package github.com/caddyserver/xcaddy/cmd/xcaddy
go: found github.com/caddyserver/xcaddy/cmd/xcaddy in github.com/caddyserver/xcaddy v0.1.7
main.go:8:2: import "github.com/caddyserver/xcaddy/cmd/xcaddy" is a program, not an importable package
2021/01/21 02:21:54 [INFO] Cleaning up temporary folder: /tmp/buildenv_2021-01-21-0221.217691415
2021/01/21 02:21:54 [ERROR] exit status 1

I build mercure and vulcain modules. But not showing.

I am not sure what you want your go.mod file to be doing… that’s very unusual.

I think you want to follow these instructions: Build from source — Caddy Documentation

This topic was automatically closed after 30 days. New replies are no longer allowed.