Skip to content

Commit

Permalink
inputs: rename URL() to URI()
Browse files Browse the repository at this point in the history
  • Loading branch information
fho committed Oct 26, 2018
1 parent dacf11b commit 2592445
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ func (a *App) BuildInputs() ([]BuildInput, error) {
}

for _, bi := range buildInputs {
if _, exist := dedupBuildInputs[bi.URL()]; exist {
if _, exist := dedupBuildInputs[bi.URI()]; exist {
continue
}

dedupBuildInputs[bi.URL()] = bi
dedupBuildInputs[bi.URI()] = bi
}
}

Expand Down
2 changes: 1 addition & 1 deletion buildinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import "github.com/simplesurance/baur/digest"
type BuildInput interface {
Digest() (digest.Digest, error)
String() string
URL() string
URI() string
}
2 changes: 1 addition & 1 deletion command/apps_builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func calcDigests(app *baur.App) ([]*storage.Input, string) {

storageInputs = append(storageInputs, &storage.Input{
Digest: d.String(),
URL: s.URL(),
URL: s.URI(),
})

inputDigests = append(inputDigests, &d)
Expand Down
2 changes: 1 addition & 1 deletion command/inputs_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func inputsShow(cmd *cobra.Command, args []string) {
}

sort.Slice(inputs, func(i, j int) bool {
return inputs[i].URL() < inputs[j].URL()
return inputs[i].URI() < inputs[j].URI()
})

for _, input := range inputs {
Expand Down
8 changes: 4 additions & 4 deletions dockerimg.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func (r *RemoteDockerImg) Digest() (digest.Digest, error) {
return *d, nil
}

// URL returns it's URL
func (r *RemoteDockerImg) URL() string {
return fmt.Sprintf("docker://%s", r.path)
// URI returns <repository>/<path>@:<digest>
func (r *RemoteDockerImg) URI() string {
return r.path
}

// String returns a string representation
func (r *RemoteDockerImg) String() string {
return r.URL()
return "docker image: " + r.URI()
}
7 changes: 3 additions & 4 deletions file.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package baur

import (
"fmt"
"path/filepath"

"github.com/simplesurance/baur/digest"
Expand Down Expand Up @@ -58,9 +57,9 @@ func (f *File) RepoRelPath() string {
return f.relPath
}

// URL returns an URL
func (f *File) URL() string {
return fmt.Sprintf("file://%s", f.relPath)
// URI calls RepoRelPath()
func (f *File) URI() string {
return f.RepoRelPath()
}

// String returns it's string representation
Expand Down

0 comments on commit 2592445

Please sign in to comment.