mirror of
https://github.com/caddyserver/xcaddy.git
synced 2025-01-22 08:36:28 +01:00
Rename ModulePath -> PackagePath
Technically they are packages to be imported, not necessarily paths to the containing Go module.
This commit is contained in:
parent
3742b72df8
commit
1d18c5862c
3 changed files with 12 additions and 12 deletions
10
builder.go
10
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"`
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue