Skip to content

Commit

Permalink
Merge pull request #3934 from afbjorklund/more-lint
Browse files Browse the repository at this point in the history
Clean up lint and other small report card issues
  • Loading branch information
tstromberg authored Mar 26, 2019
2 parents b9ecb78 + bfc7d79 commit f74751c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ MINIKUBE_MARKDOWN_FILES := README.md docs CONTRIBUTING.md CHANGELOG.md
MINIKUBE_BUILD_TAGS := container_image_ostree_stub containers_image_openpgp
MINIKUBE_INTEGRATION_BUILD_TAGS := integration $(MINIKUBE_BUILD_TAGS)
SOURCE_DIRS = cmd pkg test
SOURCE_PACKAGES = ./cmd/... ./pkg/... ./test/...

# $(call DOCKER, image, command)
define DOCKER
Expand Down Expand Up @@ -237,9 +238,13 @@ gendocs: out/docs/minikube.md
fmt:
@gofmt -l -s -w $(SOURCE_DIRS)

.PHONY: vet
vet:
@go vet $(SOURCE_PACKAGES)

.PHONY: lint
lint:
@golint $(MINIKUBE_TEST_FILES)
@golint -set_exit_status $(SOURCE_PACKAGES)

.PHONY: reportcard
reportcard:
Expand Down
2 changes: 1 addition & 1 deletion docs/contributors/build_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $ ./out/minikube start

## Running Tests

#### Unit Tests
### Unit Tests

Unit tests are run on Travis before code is merged. To run as part of a development cycle:

Expand Down
2 changes: 1 addition & 1 deletion docs/drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sudo apt install libvirt-bin libvirt-daemon-system qemu-kvm
sudo yum install libvirt-daemon-kvm qemu-kvm
```

Enable,start, and verify the `libvirtd` service has started.
Enable,start, and verify the `libvirtd` service has started.

```shell
sudo systemctl enable libvirtd.service
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/assets/vm_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ func (m *BinDataAsset) loadData(isTemplate bool) error {
return nil
}

// IsTemplate returns if the asset is a template
func (m *BinDataAsset) IsTemplate() bool {
return m.template != nil
}

// Evaluate evaluates the template to a new asset
func (m *BinDataAsset) Evaluate(data interface{}) (*MemoryAsset, error) {
if !m.IsTemplate() {
return nil, errors.Errorf("the asset %s is not a template", m.AssetName)
Expand Down
6 changes: 3 additions & 3 deletions pkg/minikube/cluster/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type mockMountHost struct {
T *testing.T
}

func NewMockMountHost(t *testing.T) *mockMountHost {
func newMockMountHost(t *testing.T) *mockMountHost {
return &mockMountHost{
T: t,
cmds: []string{},
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestMount(t *testing.T) {
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
h := NewMockMountHost(t)
h := newMockMountHost(t)
err := Mount(h, tc.source, tc.target, tc.cfg)
if err != nil {
t.Fatalf("Mount(%s, %s, %+v): %v", tc.source, tc.target, tc.cfg, err)
Expand All @@ -99,7 +99,7 @@ func TestMount(t *testing.T) {
}

func TestUnmount(t *testing.T) {
h := NewMockMountHost(t)
h := newMockMountHost(t)
err := Unmount(h, "/mnt")
if err != nil {
t.Fatalf("Unmount(/mnt): %v", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func GetKubeadmCachedImages(imageRepository string, kubernetesVersionStr string)
imageRepository + "kube-apiserver-amd64:" + kubernetesVersionStr,
}

ge_v1_14 := semver.MustParseRange(">=1.14.0")
v1_14plus := semver.MustParseRange(">=1.14.0")
v1_13 := semver.MustParseRange(">=1.13.0 <1.14.0")
v1_12 := semver.MustParseRange(">=1.12.0 <1.13.0")
v1_11 := semver.MustParseRange(">=1.11.0 <1.12.0")
Expand All @@ -259,7 +259,7 @@ func GetKubeadmCachedImages(imageRepository string, kubernetesVersionStr string)
}

var podInfraContainerImage string
if ge_v1_14(kubernetesVersion) {
if v1_14plus(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause-amd64:3.1"
images = append(images, []string{
podInfraContainerImage,
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/tests/provision_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (provisioner *MockProvisioner) GetOsReleaseInfo() (*provision.OsRelease, er
return nil, nil
}

// AttemptIPContact attemps to contact an IP and port
// AttemptIPContact attempts to contact an IP and port
func (provisioner *MockProvisioner) AttemptIPContact(dockerPort int) {
}

Expand Down

0 comments on commit f74751c

Please sign in to comment.