1. Caddy version (caddy version
):
C:\WINDOWS\system32>caddy version
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
2. How I run Caddy:
I’m just in test mode, so nothing fancy. I start caddy from command line with :
caddy run
a. System environment:
WIndows 10 pro 64 Version 20H2, build 19042.685
b. Command:
caddy run
c. Service/unit/compose file:
paste full file contents here
d. My complete Caddyfile or JSON config:
localhost:2015 {
respond "Hello, twirled! 2015"
}
localhost:2016 {
respond "Hello, twirled! 2016"
}
3. The problem I’m having:
I am just getting started with go and caddy.
I am following the doc here: Extending Caddy — Caddy Documentation
to extend caddy
I created rons.go directly from what is shown on the quick-start:
package mymodule
import "github.com/caddyserver/caddy/v2"
func init() {
caddy.RegisterModule(Gizmo{})
}
// Gizmo is an example; put your own type here.
type Gizmo struct {
}
// CaddyModule returns the Caddy module information.
func (Gizmo) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{
ID: "foo.gizmo",
New: func() caddy.Module { return new(Gizmo) },
}
}
then run xcaddy list-modules:
C:\Users\Ron\Desktop\TGCS-Caligo\_SandBox>xcaddy list-modules
2021/01/11 14:02:11 [INFO] Temporary folder: C:\Users\Ron\AppData\Local\Temp\buildenv_2021-01-11-1402.231386619
2021/01/11 14:02:11 [INFO] Writing main module: C:\Users\Ron\AppData\Local\Temp\buildenv_2021-01-11-1402.231386619\main.go
2021/01/11 14:02:11 [INFO] Initializing Go module
2021/01/11 14:02:11 [INFO] exec (timeout=10s): C:\Go\bin\go.exe mod init caddy
go: creating new go.mod: module caddy
2021/01/11 14:02:11 [INFO] Replace rons => C:\Users\Ron\Desktop\TGCS-Caligo\_SandBox
2021/01/11 14:02:12 [INFO] exec (timeout=10s): C:\Go\bin\go.exe mod edit -replace rons=C:\Users\Ron\Desktop\TGCS-Caligo\_SandBox
2021/01/11 14:02:12 [INFO] Pinning versions
2021/01/11 14:02:12 [INFO] exec (timeout=0s): C:\Go\bin\go.exe get -d -v github.com/caddyserver/caddy/v2
go: github.com/caddyserver/caddy/v2 upgrade => v2.3.0
2021/01/11 14:02:13 [INFO] Build environment ready
2021/01/11 14:02:13 [INFO] Building Caddy
2021/01/11 14:02:13 [INFO] exec (timeout=0s): C:\Go\bin\go.exe build -o C:\Users\Ron\Desktop\TGCS-Caligo\_SandBox\caddy.exe -ldflags -w -s -trimpath
# caddy
c:\go\src\caddy\caddy.go:62:11: undefined: AdminConfig
c:\go\src\caddy\caddy.go:63:11: undefined: Logging
c:\go\src\caddy\caddy.go:75:10: undefined: ModuleMap
c:\go\src\caddy\caddy.go:102:43: undefined: rawConfigKey
c:\go\src\caddy\caddy.go:124:9: undefined: unsyncedConfigAccess
c:\go\src\caddy\caddy.go:130:37: undefined: rawConfigKey
c:\go\src\caddy\caddy.go:132:10: undefined: APIError
c:\go\src\caddy\caddy.go:140:3: undefined: Log
c:\go\src\caddy\caddy.go:146:34: undefined: rawConfigKey
c:\go\src\caddy\caddy.go:588:3: undefined: rawConfigKey
c:\go\src\caddy\caddy.go:146:34: too many errors
2021/01/11 14:02:14 [INFO] Cleaning up temporary folder: C:\Users\Ron\AppData\Local\Temp\buildenv_2021-01-11-1402.231386619
2021/01/11 14:02:14 [ERROR] exit status 2
4. Error messages and/or full log output:
as shown above
5. What I already tried:
I completely uninstalled go, caddy, xcaddy and reinstalled - no difference.
I modified the sample module from the webpage to change gizmo to gizmo1, and mymodule to ronsmodule - no difference.
I attempted to build caddy from source with “go buyile”, but it wants gcc, which (on windows) wants cygwin or mingW, so I installed the binary - it runs
.
xcaddy appears to want modules that aren’t here or not where it expects to find them.