Skip to content

Commit

Permalink
Fix gosec error
Browse files Browse the repository at this point in the history
Fix Integration test
  • Loading branch information
Aditi Sharma committed Dec 1, 2020
1 parent 85c504b commit 51a4f4f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ require (
github.com/stretchr/testify v1.6.1
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/zalando/go-keyring v0.1.0
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
gopkg.in/AlecAivazis/survey.v1 v1.8.0
gopkg.in/yaml.v2 v2.3.0
k8s.io/api v0.18.2
Expand Down
6 changes: 3 additions & 3 deletions pkg/log/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/mattn/go-colorable"
"github.com/openshift/odo/pkg/log/fidget"
"github.com/spf13/pflag"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)

// Spacing for logging
Expand Down Expand Up @@ -70,7 +70,7 @@ func IsTerminal(w io.Writer) bool {
if runtime.GOOS == "windows" {
return true
} else if v, ok := (w).(*os.File); ok {
return terminal.IsTerminal(int(v.Fd()))
return term.IsTerminal(int(v.Fd()))
}
return false
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func getTerminalWidth(w io.Writer) *int {
if runtime.GOOS != "windows" {

if v, ok := (w).(*os.File); ok {
w, _, err := terminal.GetSize(int(v.Fd()))
w, _, err := term.GetSize(int(v.Fd()))
if err == nil {
return &w
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/odo/cli/component/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,16 +895,17 @@ func downloadGitProject(starterProject *devfilev1.StarterProject, starterToken,
return errors.Wrapf(err, "unable to get default project source for starter project %s", starterProject.Name)
}

refName := plumbing.ReferenceName(revision)

if revision != "" {
log.Warning("Specifying 'revision' in 'checkoutFrom' is not yet supported in odo.")
// lets consider revision to be a branch name first
refName = plumbing.NewBranchReferenceName(revision)
}

downloadSpinner := log.Spinnerf("Downloading starter project %s from %s", starterProject.Name, remoteUrl)
defer downloadSpinner.End(false)

// lets consider revision to be a branch name first
refName := plumbing.NewBranchReferenceName(revision)

cloneOptions := &git.CloneOptions{
URL: remoteUrl,
RemoteName: remoteName,
Expand Down Expand Up @@ -936,7 +937,7 @@ func downloadGitProject(starterProject *devfilev1.StarterProject, starterToken,

// it returns the following error if no matching ref found
// if we get this error, we are trying again considering revision as tag.
if _, ok := err.(git.NoMatchingRefSpecError); !ok {
if _, ok := err.(git.NoMatchingRefSpecError); !ok || revision == "" {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/odo/cli/service/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"k8s.io/klog"

"github.com/mgutz/ansi"
terminal2 "golang.org/x/crypto/ssh/terminal"
terminal2 "golang.org/x/term"
"gopkg.in/AlecAivazis/survey.v1"
"gopkg.in/AlecAivazis/survey.v1/core"
"gopkg.in/AlecAivazis/survey.v1/terminal"
Expand Down

0 comments on commit 51a4f4f

Please sign in to comment.