Skip to content

Commit

Permalink
Merge pull request #215 from revel/hotfix/v1.1.1_2
Browse files Browse the repository at this point in the history
Removed duplicate package requests
  • Loading branch information
brendensoares authored Apr 12, 2022
2 parents d83d2d5 + cedce5f commit 4950c86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "Clean-Test-Project",
"type": "shell",
"command": "rm -rf ${workspaceRoot}/.temp/revel/testproject"
"command": "rm -rf ${workspaceRoot}/.temp/revel/reveltest"
},
{
"label": "Update Go Mod",
Expand Down
21 changes: 18 additions & 3 deletions harness/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,33 @@ func Build(c *model.CommandConfig, paths *model.RevelContainer) (_ *App, err err
utils.Logger.Info("Build failed no missing imports", "message", stOutput)
return nil, newCompileError(paths, output)
}
utils.Logger.Warn("Detected missing packages, importing them", "packages", len(matches))
// Reduce the matches down to unique ones
missedPkgs := []string{}
for _, match := range matches {
found := false
for _, pkgName := range missedPkgs {
if match[1] == pkgName {
found = true
break
}
}
if !found {
missedPkgs = append(missedPkgs, match[1])
}
}

utils.Logger.Warn("Detected missing packages, importing them", "packages", len(matches))
for _, pkgName := range missedPkgs {
// Ensure we haven't already tried to go get it.
pkgName := match[1]

utils.Logger.Info("Trying to import ", "package", pkgName)
if _, alreadyTried := gotten[pkgName]; alreadyTried {
utils.Logger.Error("Failed to import ", "package", pkgName)
return nil, newCompileError(paths, output)
}
gotten[pkgName] = struct{}{}
if err := c.PackageResolver(pkgName); err != nil {
panic("failed to resolve")
// panic("failed to resolve")
utils.Logger.Error("Unable to resolve package", "package", pkgName, "error", err)
return nil, newCompileError(paths, []byte(err.Error()))
}
Expand Down
4 changes: 2 additions & 2 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package cmd

const (
// Version current Revel version
Version = "1.1.0"
Version = "1.1.2"

// BuildDate latest commit/release date
BuildDate = "2022-04-11"
BuildDate = "2022-04-12"

// MinimumGoVersion minimum required Go version for Revel
MinimumGoVersion = ">= go1.17"
Expand Down

0 comments on commit 4950c86

Please sign in to comment.