1
0
mirror of https://github.com/containers/buildah.git synced 2025-04-18 07:04:05 +03:00

ci: add nolintlint, fix found issues

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2025-03-31 23:29:12 -07:00
parent 2162b3c93a
commit e8dba98314
10 changed files with 16 additions and 15 deletions

View File

@ -12,6 +12,7 @@ formatters:
linters:
enable:
- nolintlint
- revive
- unconvert
- unparam

2
add.go
View File

@ -622,7 +622,7 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption
}
// Check for dockerignore-style exclusion of this item.
if rel != "." {
excluded, err := pm.Matches(filepath.ToSlash(rel)) // nolint:staticcheck
excluded, err := pm.Matches(filepath.ToSlash(rel)) //nolint:staticcheck
if err != nil {
return fmt.Errorf("checking if %q(%q) is excluded: %w", globbed, rel, err)
}

View File

@ -975,7 +975,7 @@ func pathIsExcluded(root, path string, pm *fileutils.PatternMatcher) (string, bo
// Matches uses filepath.FromSlash() to convert candidates before
// checking if they match the patterns it's been given, implying that
// it expects Unix-style paths.
matches, err := pm.Matches(filepath.ToSlash(rel)) // nolint:staticcheck
matches, err := pm.Matches(filepath.ToSlash(rel)) //nolint:staticcheck
if err != nil {
return rel, false, fmt.Errorf("copier: error checking if %q is excluded: %w", rel, err)
}
@ -2081,7 +2081,7 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
// set xattrs, including some that might have been reset by chown()
if !req.PutOptions.StripXattrs {
xattrs := mapWithPrefixedKeysWithoutKeyPrefix(hdr.PAXRecords, xattrPAXRecordNamespace)
if err = Lsetxattrs(path, xattrs); err != nil { // nolint:staticcheck
if err = Lsetxattrs(path, xattrs); err != nil {
if !req.PutOptions.IgnoreXattrErrors {
return fmt.Errorf("copier: put: error setting extended attributes on %q: %w", path, err)
}

View File

@ -48,7 +48,7 @@ func makeContents(length int64) io.ReadCloser {
for count < length {
if _, err := buffered.Write([]byte{"0123456789abcdef"[count%16]}); err != nil {
buffered.Flush()
pipeWriter.CloseWithError(err) // nolint:errcheck
pipeWriter.CloseWithError(err)
return
}
count++
@ -111,7 +111,7 @@ func makeArchive(headers []tar.Header, contents map[string][]byte) io.ReadCloser
tw.Close()
buffered.Flush()
if err != nil {
pipeWriter.CloseWithError(err) // nolint:errcheck
pipeWriter.CloseWithError(err)
} else {
pipeWriter.Close()
}

View File

@ -164,7 +164,7 @@ type V1Image struct {
// V2Image stores the image configuration
type V2Image struct {
V1Image
Parent ID `json:"parent,omitempty"` // nolint:govet
Parent ID `json:"parent,omitempty"`
RootFS *V2S2RootFS `json:"rootfs,omitempty"`
History []V2S2History `json:"history,omitempty"`
OSVersion string `json:"os.version,omitempty"`

View File

@ -22,8 +22,8 @@ func get() (Rusage, error) {
Date: time.Now(),
Utime: mkduration(rusage.Utime),
Stime: mkduration(rusage.Stime),
Inblock: int64(rusage.Inblock), // nolint: unconvert
Outblock: int64(rusage.Oublock), // nolint: unconvert
Inblock: int64(rusage.Inblock), //nolint:unconvert
Outblock: int64(rusage.Oublock), //nolint:unconvert
}
return r, nil
}

View File

@ -870,13 +870,13 @@ func runCopyStdio(logger *logrus.Logger, stdio *sync.WaitGroup, copyPipes bool,
return
}
if blocked {
defer setNonblock(logger, rfd, readDesc[rfd], false) // nolint:errcheck
defer setNonblock(logger, rfd, readDesc[rfd], false) //nolint:errcheck
}
setNonblock(logger, wfd, writeDesc[wfd], false) // nolint:errcheck
setNonblock(logger, wfd, writeDesc[wfd], false) //nolint:errcheck
}
if copyPipes {
setNonblock(logger, stdioPipe[unix.Stdin][1], writeDesc[stdioPipe[unix.Stdin][1]], true) // nolint:errcheck
setNonblock(logger, stdioPipe[unix.Stdin][1], writeDesc[stdioPipe[unix.Stdin][1]], true) //nolint:errcheck
}
runCopyStdioPassData(copyPipes, stdioPipe, finishCopy, relayMap, relayBuffer, readDesc, writeDesc)

View File

@ -691,9 +691,9 @@ func setupSlirp4netnsNetwork(config *config.Config, netns, cid string, options,
}
return func() {
syscall.Kill(res.Pid, syscall.SIGKILL) // nolint:errcheck
syscall.Kill(res.Pid, syscall.SIGKILL) //nolint:errcheck
var status syscall.WaitStatus
syscall.Wait4(res.Pid, &status, 0, nil) // nolint:errcheck
syscall.Wait4(res.Pid, &status, 0, nil) //nolint:errcheck
}, result, nil
}

View File

@ -934,7 +934,7 @@ func fsHeaderForEntry(hdr *tar.Header) FSHeader {
ModTime: hdr.ModTime,
Devmajor: hdr.Devmajor,
Devminor: hdr.Devminor,
Xattrs: hdr.Xattrs, // nolint:staticcheck
Xattrs: hdr.Xattrs, //nolint:staticcheck
}
}

View File

@ -97,7 +97,7 @@ func main() {
errors := false
defer func() {
store.Shutdown(false) // nolint:errcheck
store.Shutdown(false) //nolint:errcheck
if errors {
os.Exit(1)
}