mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 15:27:16 +02:00
Replace gometalinter with GolangCI-Lint
gometalinter is broken @ HEAD, and I looked into why that was. During that process, I remembered that we took the linting scripts from skaffold, and found that in skaffold gometalinter was replaced with GolangCI-Lint: https://github.com/GoogleContainerTools/skaffold/pull/619 The change made linting in skaffold faster, so I figured instead of fixing gometalinter it made more sense to remove it and replace it with GolangCI-Lint for kaniko as well.
This commit is contained in:
@@ -17,8 +17,9 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/constants"
|
||||
"strings"
|
||||
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/constants"
|
||||
)
|
||||
|
||||
func GetBucketAndItem(context string) (string, string) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/GoogleContainerTools/kaniko/testutil"
|
||||
)
|
||||
|
||||
var testUrl = "https://github.com/GoogleContainerTools/runtimes-common/blob/master/LICENSE"
|
||||
var testURL = "https://github.com/GoogleContainerTools/runtimes-common/blob/master/LICENSE"
|
||||
|
||||
var testEnvReplacement = []struct {
|
||||
path string
|
||||
@@ -220,7 +220,7 @@ var matchSourcesTests = []struct {
|
||||
srcs: []string{
|
||||
"pkg/*",
|
||||
"/root/dir?",
|
||||
testUrl,
|
||||
testURL,
|
||||
},
|
||||
files: []string{
|
||||
"pkg/a",
|
||||
@@ -234,7 +234,7 @@ var matchSourcesTests = []struct {
|
||||
"/root/dir1",
|
||||
"pkg/a",
|
||||
"pkg/b",
|
||||
testUrl,
|
||||
testURL,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -344,11 +344,11 @@ var isSrcValidTests = []struct {
|
||||
},
|
||||
{
|
||||
srcsAndDest: []string{
|
||||
testUrl,
|
||||
testURL,
|
||||
"dest",
|
||||
},
|
||||
resolvedSources: []string{
|
||||
testUrl,
|
||||
testURL,
|
||||
},
|
||||
shouldErr: false,
|
||||
},
|
||||
@@ -369,13 +369,13 @@ var testResolveSources = []struct {
|
||||
srcsAndDest: []string{
|
||||
"context/foo",
|
||||
"context/b*",
|
||||
testUrl,
|
||||
testURL,
|
||||
"dest/",
|
||||
},
|
||||
expectedList: []string{
|
||||
"context/foo",
|
||||
"context/bar",
|
||||
testUrl,
|
||||
testURL,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -343,8 +343,8 @@ func filesAreHardlinks(first, second string) checker {
|
||||
if err != nil {
|
||||
t.Fatalf("error getting file %s", second)
|
||||
}
|
||||
stat1 := getSyscallStat_t(fi1)
|
||||
stat2 := getSyscallStat_t(fi2)
|
||||
stat1 := getSyscallStatT(fi1)
|
||||
stat2 := getSyscallStatT(fi2)
|
||||
if stat1.Ino != stat2.Ino {
|
||||
t.Errorf("%s and %s aren't hardlinks as they dont' have the same inode", first, second)
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
"github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/empty"
|
||||
"github.com/google/go-containerregistry/pkg/v1/partial"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
"github.com/google/go-containerregistry/pkg/v1/tarball"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -61,7 +62,7 @@ func RetrieveSourceImage(stage config.KanikoStage, buildArgs []string) (v1.Image
|
||||
}
|
||||
|
||||
// RetrieveConfigFile returns the config file for an image
|
||||
func RetrieveConfigFile(sourceImage v1.Image) (*v1.ConfigFile, error) {
|
||||
func RetrieveConfigFile(sourceImage partial.WithConfigFile) (*v1.ConfigFile, error) {
|
||||
imageConfig, err := sourceImage.ConfigFile()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -118,7 +118,7 @@ func (t *Tar) Whiteout(p string) error {
|
||||
func (t *Tar) checkHardlink(p string, i os.FileInfo) (bool, string) {
|
||||
hardlink := false
|
||||
linkDst := ""
|
||||
stat := getSyscallStat_t(i)
|
||||
stat := getSyscallStatT(i)
|
||||
if stat != nil {
|
||||
nlinks := stat.Nlink
|
||||
if nlinks > 1 {
|
||||
@@ -135,7 +135,7 @@ func (t *Tar) checkHardlink(p string, i os.FileInfo) (bool, string) {
|
||||
return hardlink, linkDst
|
||||
}
|
||||
|
||||
func getSyscallStat_t(i os.FileInfo) *syscall.Stat_t {
|
||||
func getSyscallStatT(i os.FileInfo) *syscall.Stat_t {
|
||||
if sys := i.Sys(); sys != nil {
|
||||
if stat, ok := sys.(*syscall.Stat_t); ok {
|
||||
return stat
|
||||
|
||||
Reference in New Issue
Block a user