diff --git a/builder.go b/builder.go index 50571c6..f4f4801 100644 --- a/builder.go +++ b/builder.go @@ -131,12 +131,12 @@ func setEnv(env []string, set string) []string { // Dependency pairs a Go module path with a version. type Dependency struct { - // The name (path) of the Go module. If at a version > 1, it - // should contain semantic import version suffix (i.e. "/v2"). - // Used with `go get` - ModulePath string `json:"module_path,omitempty"` + // The name (import path) of the Go package. If at a version > 1, + // it should contain semantic import version (i.e. "/v2"). + // Used with `go get`. + PackagePath string `json:"module_path,omitempty"` - // The version of the Go module, like used with `go get`. + // The version of the Go module, as used with `go get`. Version string `json:"version,omitempty"` } diff --git a/cmd/xcaddy/main.go b/cmd/xcaddy/main.go index e8c778d..950a3d5 100644 --- a/cmd/xcaddy/main.go +++ b/cmd/xcaddy/main.go @@ -70,8 +70,8 @@ func runBuild(ctx context.Context, args []string) error { } mod = strings.TrimSuffix(mod, "/") // easy to accidentally leave a trailing slash if pasting from a URL, but is invalid for Go modules plugins = append(plugins, xcaddy.Dependency{ - ModulePath: mod, - Version: ver, + PackagePath: mod, + Version: ver, }) if repl != "" { replacements = append(replacements, xcaddy.Replace{ @@ -211,7 +211,7 @@ func runDev(ctx context.Context, args []string) error { }, CaddyVersion: caddyVersion, Plugins: []xcaddy.Dependency{ - {ModulePath: importPath}, + {PackagePath: importPath}, }, Replacements: replacements, RaceDetector: raceDetector, diff --git a/environment.go b/environment.go index b7f921a..c00d33f 100644 --- a/environment.go +++ b/environment.go @@ -41,7 +41,7 @@ func (b Builder) newEnvironment(ctx context.Context) (*environment, error) { // clean up any SIV-incompatible module paths real quick for i, p := range b.Plugins { - b.Plugins[i].ModulePath, err = versionedModulePath(p.ModulePath, p.Version) + b.Plugins[i].PackagePath, err = versionedModulePath(p.PackagePath, p.Version) if err != nil { return nil, err } @@ -52,7 +52,7 @@ func (b Builder) newEnvironment(ctx context.Context) (*environment, error) { CaddyModule: caddyModulePath, } for _, p := range b.Plugins { - tplCtx.Plugins = append(tplCtx.Plugins, p.ModulePath) + tplCtx.Plugins = append(tplCtx.Plugins, p.PackagePath) } // evaluate the template for the main module @@ -139,11 +139,11 @@ nextPlugin: // a plugin package may be a subfolder of a module, i.e. // foo/a/plugin is within module foo/a. for repl := range replaced { - if strings.HasPrefix(p.ModulePath, repl) { + if strings.HasPrefix(p.PackagePath, repl) { continue nextPlugin } } - err = env.execGoGet(ctx, p.ModulePath, p.Version) + err = env.execGoGet(ctx, p.PackagePath, p.Version) if err != nil { return nil, err }