Skip to content

Commit

Permalink
Enhance logging
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Mar 15, 2021
1 parent ee422a4 commit 5c64214
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,15 @@ func compile(image string, config *ConfigFlags, flags *BuildFlags, folder string
if strings.HasPrefix(config.Repository, string(filepath.Separator)) || strings.HasPrefix(config.Repository, ".") {
// Resolve the repository import path from the file path
config.Repository = resolveImportPath(config.Repository)
log.Printf("INFO: Root path is %s", config.Repository)

// Determine if this is a module-based repository
var modFile = config.Repository + "/go.mod"
_, err := os.Stat(modFile)
usesModules = !os.IsNotExist(err)
if !usesModules {
log.Println("INFO: Don't use go modules (go.mod not found)")
}

// Iterate over all the local libs and export the mount points
if os.Getenv("GOPATH") == "" && !usesModules {
Expand Down Expand Up @@ -338,17 +342,17 @@ func compileContained(config *ConfigFlags, flags *BuildFlags, folder string) err
// If a local build was requested, resolve the import path
local := strings.HasPrefix(config.Repository, string(filepath.Separator)) || strings.HasPrefix(config.Repository, ".")
if local {
config.Repository = resolveImportPath(config.Repository)

// Resolve the repository import path from the file path
config.Repository = resolveImportPath(config.Repository)
log.Printf("INFO: Root path is %s", config.Repository)

// Determine if this is a module-based repository
var modFile = config.Repository + "/go.mod"
_, err := os.Stat(modFile)
usesModules := !os.IsNotExist(err)
if !usesModules {
os.Setenv("GO111MODULE", "off")
log.Println("INFO: Don't use go modules (go.mod not found)")
}
}
// Fine tune the original environment variables with those required by the build script
Expand Down

0 comments on commit 5c64214

Please sign in to comment.