Skip to content

Commit

Permalink
Rename 'legacy' imports to 'classic' imports
Browse files Browse the repository at this point in the history
  • Loading branch information
debovema committed Feb 28, 2019
1 parent 4f64254 commit 7936447
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions util/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Import interface {
GoImportPath() string // the import path used in .go files
GoGetImportPath() string // the import path used by "go get" command
GoModImportPath() string // the import path used by "go mod edit" command
IsLegacy() bool // an import is "legacy" if it does not have a relative import path
IsClassic() bool // an import is "classic" if it has no : character separator, hence no relative import path
}

type Imports []Import
Expand Down Expand Up @@ -100,7 +100,7 @@ func (flogoImport *FlogoImport) GoModImportPath() string {
}
return flogoImport.modulePath + version
}
func (flogoImport *FlogoImport) IsLegacy() bool {
func (flogoImport *FlogoImport) IsClassic() bool {
return flogoImport.relativeImportPath == ""
}

Expand Down
4 changes: 2 additions & 2 deletions util/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ func (m *ModDepManager) AddDependency(flogoImport Import) error {
err = ExecCmd(exec.Command("go", "mod", "download", flogoImport.ModulePath()), m.srcDir)

if err != nil {
// if the resolution fails and the Flogo import is "legacy"
// if the resolution fails and the Flogo import is "classic"
// (meaning it does not separate module path from Go import path):
// 1. remove the import manually ("go mod edit -droprequire") would fail
// 2. try with "go get" instead
if flogoImport.IsLegacy() {
if flogoImport.IsClassic() {
m.RemoveImport(flogoImport)

err = ExecCmd(exec.Command("go", "get", "-u", flogoImport.GoGetImportPath()), m.srcDir)
Expand Down

0 comments on commit 7936447

Please sign in to comment.