fix linting errors
parent
e8329f6380
commit
7fc7b245e1
1
go.mod
1
go.mod
|
@ -57,7 +57,6 @@ require (
|
|||
github.com/moby/hyperkit v0.0.0-20171020124204-a12cd7250bcd
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
|
||||
github.com/nicksnyder/go-i18n/v2 v2.0.0-beta.7
|
||||
github.com/olekukonko/tablewriter v0.0.0-20160923125401-bdcc175572fd
|
||||
github.com/onsi/ginkgo v1.8.0 // indirect
|
||||
github.com/onsi/gomega v1.5.0 // indirect
|
||||
|
|
1
go.sum
1
go.sum
|
@ -208,6 +208,7 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI
|
|||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
|
|
|
@ -87,7 +87,9 @@ func TestOut(t *testing.T) {
|
|||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.format, func(t *testing.T) {
|
||||
translate.SetPreferredLanguage(tc.lang)
|
||||
if err := translate.SetPreferredLanguage(tc.lang); err != nil {
|
||||
t.Errorf("unexpected error: %q", err)
|
||||
}
|
||||
f := tests.NewFakeFile()
|
||||
SetOutFile(f)
|
||||
ErrLn("unrelated message")
|
||||
|
@ -140,7 +142,9 @@ func TestSetPreferredLanguage(t *testing.T) {
|
|||
for _, tc := range tests {
|
||||
t.Run(tc.input, func(t *testing.T) {
|
||||
// Set something so that we can assert change.
|
||||
translate.SetPreferredLanguage("is")
|
||||
if err := translate.SetPreferredLanguage("is"); err != nil {
|
||||
t.Errorf("unexpected error: %q", err)
|
||||
}
|
||||
if err := translate.SetPreferredLanguage(tc.input); err != nil {
|
||||
t.Errorf("unexpected error: %q", err)
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ type state struct {
|
|||
// The file we're currently checking
|
||||
filename string
|
||||
|
||||
// THe package we're currenly in
|
||||
// The package we're currently in
|
||||
currentPackage string
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ func newExtractor(functionsToCheck []string) (*state, error) {
|
|||
fs := stack.New()
|
||||
|
||||
for _, t := range functionsToCheck {
|
||||
// Functions must be of the form "package.function"
|
||||
t2 := strings.Split(t, ".")
|
||||
if len(t2) < 2 {
|
||||
return nil, errors.Wrap(nil, fmt.Sprintf("Invalid function string %s. Needs package name as well.", t))
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
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 extract
|
||||
|
||||
import (
|
||||
|
@ -37,7 +53,10 @@ func TestExtract(t *testing.T) {
|
|||
t.Fatalf("Reading json file: %s", err)
|
||||
}
|
||||
|
||||
json.Unmarshal(f, &got)
|
||||
err = json.Unmarshal(f, &got)
|
||||
if err != nil {
|
||||
t.Fatalf("Error unmarshalling json: %v", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expected, got) {
|
||||
t.Fatalf("Translation JSON not equal: expected %v, got %v", expected, got)
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
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 extract
|
||||
|
||||
import "fmt"
|
||||
|
|
Loading…
Reference in New Issue