Fix lint and tests

This commit is contained in:
Zach Wasserman 2021-01-12 19:07:59 -08:00
parent 45978084da
commit 36478cd96c
3 changed files with 5 additions and 16 deletions

10
main.go
View file

@ -166,13 +166,3 @@ func main() {
log.Println("Error:", err)
}
}
func initialize(c *cli.Context) error {
fmt.Println(c.String("root-dir"))
err := os.MkdirAll(c.String("root-dir"), constant.DefaultDirMode)
if err != nil {
return errors.Wrap(err, "make root directory")
}
return nil
}

View file

@ -27,9 +27,8 @@ const (
// Updater is responsible for managing update state.
type Updater struct {
opt Options
transport *http.Transport
client *client.Client
opt Options
client *client.Client
}
// Options are the options that can be provided when creating an Updater.
@ -122,7 +121,7 @@ func makeLocalPath(name, platform, version string) string {
func (u *Updater) Lookup(name, platform, version string) (*data.TargetFileMeta, error) {
target, err := u.client.Target(makeRepoPath(name, platform, version))
if err != nil {
return nil, errors.Wrapf(err, "lookup target %s", target)
return nil, errors.Wrapf(err, "lookup target %v", target)
}
return &target, nil

View file

@ -33,7 +33,7 @@ func assertDir(t *testing.T, path string) {
assert.True(t, info.IsDir())
}
func TestMakePath(t *testing.T) {
func TestMakeRepoPath(t *testing.T) {
t.Parallel()
testCases := []struct {
@ -50,7 +50,7 @@ func TestMakePath(t *testing.T) {
t.Run(tt.expected, func(t *testing.T) {
t.Parallel()
assert.Equal(t, tt.expected, makePath(tt.name, tt.platform, tt.version))
assert.Equal(t, tt.expected, makeRepoPath(tt.name, tt.platform, tt.version))
})
}
}