Skip to content

Commit

Permalink
chore: fix misc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
femnad committed Apr 29, 2024
1 parent f32ca97 commit bc2ecaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 9 additions & 4 deletions entity/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ func processUrl(repoUrl string) (cloneRef, error) {
}

repoBase := components[numComponents-1]
if strings.HasSuffix(repoBase, gitRepoSuffix) {
repoBase = repoBase[:len(repoBase)-len(gitRepoSuffix)]
}
repoBase = strings.TrimSuffix(repoBase, gitRepoSuffix)
ref.base = repoBase

if strings.HasPrefix(repoUrl, gitClonePrefix) {
Expand Down Expand Up @@ -134,6 +132,10 @@ func clone(repo Repo, repoUrl cloneRef, cloneDir string) error {

for remote, remoteUrl := range repo.Remotes {
remoteExpanded, remoteErr := processUrl(remoteUrl)
if remoteErr != nil {
return remoteErr
}

_, remoteErr = r.CreateRemote(&config.RemoteConfig{
Name: remote,
URLs: []string{remoteExpanded.url},
Expand Down Expand Up @@ -177,11 +179,14 @@ func CloneUnderPath(repo Repo, dir string, cloneEnv map[string]string) error {
newEnv[k] = true
}
err = os.Setenv(k, v)
if err != nil {
return err
}
}

cloneErr := clone(repo, repoUrl, cloneDir)

for k, _ := range newEnv {
for k := range newEnv {
err = os.Unsetenv(k)
if err != nil {
return errors.Join(cloneErr, err)
Expand Down
4 changes: 0 additions & 4 deletions entity/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ func (p PythonPkg) GetLookupID() string {
return p.Name()
}

func (p PythonPkg) hasVersionLookup() bool {
return p.VersionLookup.URL != ""
}

func (p PythonPkg) DefaultVersionCmd() string {
return fmt.Sprintf("%s -V", p.Name())
}
Expand Down

0 comments on commit bc2ecaf

Please sign in to comment.