Skip to content

Commit

Permalink
Merge pull request #3150 from bobbypage/upstream/presubmit
Browse files Browse the repository at this point in the history
Re-enable presubmit linting
  • Loading branch information
bobbypage authored Aug 10, 2022
2 parents 9c6fb75 + 225af2b commit c37f32f
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ issues:
- "(method|func) [A-Z].* should be .*"
# Stuttering affects exported names:
- "type name will be used as .*\\.[A-Z]{1}.* by other packages, and that stutters"
# TODO: Migrate away from io/ioutil
- "\"io/ioutil\" has been deprecated since Go 1.16"
exclude-rules:
# utils/cpuload/netlink/netlink.go:102:15: Error return value of `binary.Write` is not checked (errcheck)
# There are more similar issues in this file
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

GO := go
GOLANGCI_VER := v1.45.2
GOLANGCI_VER := v1.48.0
GO_TEST ?= $(GO) test $(or $(GO_FLAGS),-race)
arch ?= $(shell go env GOARCH)

Expand Down Expand Up @@ -74,7 +74,7 @@ docker-%:
docker-build:
@docker run --rm -w /go/src/github.com/google/cadvisor -v ${PWD}:/go/src/github.com/google/cadvisor golang:1.19 make build

presubmit: # lint : TODO re-enable lint after it works on golang 1.19
presubmit: lint
@echo ">> checking go mod tidy"
@./build/check_gotidy.sh
@echo ">> checking file boilerplate"
Expand Down
1 change: 1 addition & 0 deletions accelerators/nvidia.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package accelerators

import (
Expand Down
1 change: 1 addition & 0 deletions accelerators/nvidia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package accelerators

import (
Expand Down
4 changes: 3 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

// This is an implementation of a cAdvisor REST API in Go.
// To use it, create a client (replace the URL with your actual cAdvisor REST endpoint):
// client, err := client.NewClient("http://192.168.59.103:8080/")
//
// client, err := client.NewClient("http://192.168.59.103:8080/")
//
// Then, the client interface exposes go methods corresponding to the REST endpoints.
package client

Expand Down
2 changes: 1 addition & 1 deletion cmd/cadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func createCollectorHTTPClient(collectorCert, collectorKey string) http.Client {
}

tlsConfig.Certificates = []tls.Certificate{cert}
tlsConfig.BuildNameToCertificate()
tlsConfig.BuildNameToCertificate() //nolint: staticcheck
}

transport := &http.Transport{
Expand Down
2 changes: 1 addition & 1 deletion container/containerd/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//This code has been taken from containerd repo to avoid large library import
// This code has been taken from containerd repo to avoid large library import
package containerd

import (
Expand Down
2 changes: 0 additions & 2 deletions container/containerd/namespaces/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import "context"
// oriented. A namespace is really just a name and a set of labels. Objects
// that belong to a namespace are returned when the namespace is assigned to a
// given context.
//
//
type Store interface {
Create(ctx context.Context, namespace string, labels map[string]string) error
Labels(ctx context.Context, namespace string) (map[string]string, error)
Expand Down
1 change: 1 addition & 0 deletions devicemapper/dmsetup_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package devicemapper

import (
Expand Down
1 change: 1 addition & 0 deletions devicemapper/fake/dmsetup_client_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package fake

import (
Expand Down
1 change: 1 addition & 0 deletions devicemapper/fake/thin_ls_client_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package fake

type FakeThinLsClient struct {
Expand Down
1 change: 1 addition & 0 deletions devicemapper/thin_ls_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package devicemapper

import (
Expand Down
1 change: 1 addition & 0 deletions devicemapper/thin_ls_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package devicemapper

import (
Expand Down
1 change: 1 addition & 0 deletions devicemapper/thin_pool_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package devicemapper

import (
Expand Down
1 change: 1 addition & 0 deletions devicemapper/thin_pool_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package devicemapper

import (
Expand Down
1 change: 1 addition & 0 deletions devicemapper/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package devicemapper

import (
Expand Down
13 changes: 7 additions & 6 deletions integration/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ type Framework interface {
//
// Typical use:
//
// func TestFoo(t *testing.T) {
// fm := framework.New(t)
// defer fm.Cleanup()
// ... actual test ...
// }
// func TestFoo(t *testing.T) {
// fm := framework.New(t)
// defer fm.Cleanup()
// ... actual test ...
// }
func New(t *testing.T) Framework {
// All integration tests are large.
if testing.Short() {
Expand Down Expand Up @@ -240,7 +240,8 @@ type DockerRunArgs struct {
//
// e.g.:
// RunDockerContainer(DockerRunArgs{Image: "busybox"}, "ping", "www.google.com")
// -> docker run busybox ping www.google.com
//
// -> docker run busybox ping www.google.com
func (a dockerActions) Run(args DockerRunArgs, cmd ...string) string {
dockerCommand := append(append([]string{"docker", "run", "-d"}, args.Args...), args.Image)
dockerCommand = append(dockerCommand, cmd...)
Expand Down
1 change: 0 additions & 1 deletion resctrl/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// Mocked environment:
// - "container" first container with {1, 2, 3} processes.
// - "another" second container with {5, 6} processes.
//
package resctrl

import (
Expand Down
1 change: 1 addition & 0 deletions zfs/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package zfs

import (
Expand Down

0 comments on commit c37f32f

Please sign in to comment.