mirror of
https://github.com/ko-build/ko.git
synced 2025-07-12 23:50:31 +02:00
Always clean Dir for packages.Load
This commit is contained in:
committed by
Halvard Skogsrud
parent
8135bf22e9
commit
73a4629033
@ -161,8 +161,8 @@ func NewGo(ctx context.Context, dir string, options ...Option) (Interface, error
|
||||
}
|
||||
|
||||
func (g *gobuild) qualifyLocalImport(importpath string) (string, error) {
|
||||
dir := g.dir
|
||||
if filepath.Clean(g.dir) == "." {
|
||||
dir := filepath.Clean(g.dir)
|
||||
if dir == "." {
|
||||
dir = ""
|
||||
}
|
||||
cfg := &packages.Config{
|
||||
@ -203,8 +203,8 @@ func (g *gobuild) IsSupportedReference(s string) error {
|
||||
if !ref.IsStrict() {
|
||||
return errors.New("importpath does not start with ko://")
|
||||
}
|
||||
dir := g.dir
|
||||
if filepath.Clean(g.dir) == "." {
|
||||
dir := filepath.Clean(g.dir)
|
||||
if dir == "." {
|
||||
dir = ""
|
||||
}
|
||||
pkgs, err := packages.Load(&packages.Config{Dir: dir, Mode: packages.NeedName}, ref.Path())
|
||||
@ -446,8 +446,8 @@ func tarBinary(name, binary string, platform *v1.Platform) (*bytes.Buffer, error
|
||||
}
|
||||
|
||||
func (g *gobuild) kodataPath(ref reference) (string, error) {
|
||||
dir := g.dir
|
||||
if filepath.Clean(g.dir) == "." {
|
||||
dir := filepath.Clean(g.dir)
|
||||
if dir == "." {
|
||||
dir = ""
|
||||
}
|
||||
pkgs, err := packages.Load(&packages.Config{Dir: dir, Mode: packages.NeedFiles}, ref.Path())
|
||||
|
@ -180,8 +180,8 @@ func createBuildConfigMap(workingDirectory string, configs []build.Config) (map[
|
||||
// local import paths, therefore add a "./" equivalent as a prefix to
|
||||
// the constructured import path
|
||||
localImportPath := fmt.Sprint(".", string(filepath.Separator), path)
|
||||
dir := baseDir
|
||||
if filepath.Clean(dir) == "." {
|
||||
dir := filepath.Clean(baseDir)
|
||||
if dir == "." {
|
||||
dir = ""
|
||||
}
|
||||
pkgs, err := packages.Load(&packages.Config{Mode: packages.NeedName, Dir: dir}, localImportPath)
|
||||
|
Reference in New Issue
Block a user