diff --git a/acceptance_test.go b/acceptance_test.go index 680b092..f6a9d02 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -91,7 +91,8 @@ func TestUpgrade(t *testing.T) { target := fmt.Sprintf("./testdata/acceptance/%s", oldpkg) require.NoError(t, os.MkdirAll("./testdata/acceptance/tmp", 0o700)) - config, err := nfpm.ParseFileWithEnvMapping(fmt.Sprintf("./testdata/acceptance/%s.v1.yaml", testName), + config, err := nfpm.ParseFileWithEnvMapping( + fmt.Sprintf("./testdata/acceptance/%s.v1.yaml", testName), func(s string) string { switch s { case "BUILD_ARCH": diff --git a/apk/apk.go b/apk/apk.go index b98d277..598b290 100644 --- a/apk/apk.go +++ b/apk/apk.go @@ -61,20 +61,20 @@ func init() { // https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go // nolint: gochecknoglobals var archToAlpine = map[string]string{ - "all": "noarch", - "386": "x86", - "amd64": "x86_64", - "arm64": "aarch64", - "arm6": "armhf", - "arm7": "armv7", - "ppc64le": "ppc64le", - "s390": "s390x", - "loong64": "loongarch64", - "aarch64": "aarch64", - "x86_64": "x86_64", - "i386": "x86", - "i686": "x86", - "riscv64": "riscv64", + "all": "noarch", + "386": "x86", + "amd64": "x86_64", + "arm64": "aarch64", + "arm6": "armhf", + "arm7": "armv7", + "ppc64le": "ppc64le", + "s390": "s390x", + "loong64": "loongarch64", + "aarch64": "aarch64", + "x86_64": "x86_64", + "i386": "x86", + "i686": "x86", + "riscv64": "riscv64", } func ensureValidArch(info *nfpm.Info) *nfpm.Info { diff --git a/arch/arch.go b/arch/arch.go index 10dada2..af6d10c 100644 --- a/arch/arch.go +++ b/arch/arch.go @@ -42,17 +42,17 @@ type ArchLinux struct{} // nolint: gochecknoglobals var archToArchLinux = map[string]string{ - "all": "any", - "amd64": "x86_64", - "386": "i686", - "arm64": "aarch64", - "arm7": "armv7h", - "arm6": "armv6h", - "arm5": "arm", - "x86_64": "x86_64", - "aarch64": "aarch64", - "i386": "i686", - "riscv64": "riscv64", + "all": "any", + "amd64": "x86_64", + "386": "i686", + "arm64": "aarch64", + "arm7": "armv7h", + "arm6": "armv6h", + "arm5": "arm", + "x86_64": "x86_64", + "aarch64": "aarch64", + "i386": "i686", + "riscv64": "riscv64", } func ensureValidArch(info *nfpm.Info) *nfpm.Info { diff --git a/arch/arch_test.go b/arch/arch_test.go index fbbfe83..e225130 100644 --- a/arch/arch_test.go +++ b/arch/arch_test.go @@ -134,7 +134,8 @@ func TestArchConventionalFileName(t *testing.T) { info := exampleInfo() info.Arch = arch name := Default.ConventionalFileName(info) - require.Equal(t, + require.Equal( + t, "foo-test-1.0.0beta_1-1-"+archToArchLinux[arch]+".pkg.tar.zst", name, ) diff --git a/deb/deb.go b/deb/deb.go index 0e11722..d9718d7 100644 --- a/deb/deb.go +++ b/deb/deb.go @@ -43,18 +43,18 @@ func init() { // https://wiki.debian.org/ArchitectureSpecificsMemo // nolint: gochecknoglobals var archToDebian = map[string]string{ - "386": "i386", - "arm64": "arm64", - "arm5": "armel", - "arm6": "armhf", - "arm7": "armhf", - "mips64le": "mips64el", - "mipsle": "mipsel", - "ppc64le": "ppc64el", - "s390": "s390x", - "x86_64": "amd64", - "aarch64": "arm64", - "riscv64": "riscv64", + "386": "i386", + "arm64": "arm64", + "arm5": "armel", + "arm6": "armhf", + "arm7": "armhf", + "mips64le": "mips64el", + "mipsle": "mipsel", + "ppc64le": "ppc64el", + "s390": "s390x", + "x86_64": "amd64", + "aarch64": "arm64", + "riscv64": "riscv64", } func ensureValidArch(info *nfpm.Info) *nfpm.Info { @@ -877,7 +877,8 @@ func tarHeader(content *files.Content, preferredModTimes ...time.Time) (*tar.Hea h := &tar.Header{ Name: content.Name(), ModTime: modtime.Get( - append(preferredModTimes, content.ModTime())...), + append(preferredModTimes, content.ModTime())..., + ), Mode: int64(fm & 0o7777), Uname: content.FileInfo.Owner, Gname: content.FileInfo.Group, diff --git a/files/files.go b/files/files.go index 38442da..ebfd81e 100644 --- a/files/files.go +++ b/files/files.go @@ -553,8 +553,9 @@ func contentCollisionError(newc *Content, present *Content) error { presentSource = " with source " + present.Source } - return fmt.Errorf("adding %s at destination %s: "+ - "%s%s is already present at this destination: %w", + return fmt.Errorf( + "adding %s at destination %s: "+ + "%s%s is already present at this destination: %w", newc.Type, newc.Destination, present.Type, presentSource, ErrContentCollision, ) } diff --git a/internal/cmd/package.go b/internal/cmd/package.go index 6187156..731a89d 100644 --- a/internal/cmd/package.go +++ b/internal/cmd/package.go @@ -43,7 +43,8 @@ func newPackageCmd() *packageCmd { cmd.Flags().StringVarP(&root.packager, "packager", "p", "", fmt.Sprintf("which packager implementation to use [%s]", strings.Join(pkgs, "|"))) - _ = cmd.RegisterFlagCompletionFunc("packager", cobra.FixedCompletions(pkgs, + _ = cmd.RegisterFlagCompletionFunc("packager", cobra.FixedCompletions( + pkgs, cobra.ShellCompDirectiveNoFileComp, )) diff --git a/ipk/ipk.go b/ipk/ipk.go index d9bae5d..1c49022 100644 --- a/ipk/ipk.go +++ b/ipk/ipk.go @@ -32,20 +32,20 @@ func init() { // nolint: gochecknoglobals var archToIPK = map[string]string{ // all --> all - "386": "i386", - "amd64": "x86_64", - "arm64": "arm64", - "arm5": "armel", - "arm6": "armhf", - "arm7": "armhf", - "mips64le": "mips64el", - "mipsle": "mipsel", - "ppc64le": "ppc64el", - "s390": "s390x", - "x86_64": "x86_64", - "aarch64": "arm64", - "i386": "i386", - "riscv64": "riscv64_generic", + "386": "i386", + "amd64": "x86_64", + "arm64": "arm64", + "arm5": "armel", + "arm6": "armhf", + "arm7": "armhf", + "mips64le": "mips64el", + "mipsle": "mipsel", + "ppc64le": "ppc64el", + "s390": "s390x", + "x86_64": "x86_64", + "aarch64": "arm64", + "i386": "i386", + "riscv64": "riscv64_generic", } func ensureValidArch(info *nfpm.Info) *nfpm.Info { @@ -127,7 +127,8 @@ func (d *IPK) Package(info *nfpm.Info, ipk io.Writer) error { // Strip out any custom fields that are disallowed. stripDisallowedFields(info) - contents, err := newTGZ("ipk", + contents, err := newTGZ( + "ipk", func(tw *tar.Writer) error { return createIPK(info, tw) }, @@ -145,7 +146,8 @@ func (d *IPK) Package(info *nfpm.Info, ipk io.Writer) error { func createIPK(info *nfpm.Info, ipk *tar.Writer) error { var installSize int64 - data, err := newTGZ("data.tar.gz", + data, err := newTGZ( + "data.tar.gz", func(tw *tar.Writer) error { var err error installSize, err = populateDataTar(info, tw) @@ -156,7 +158,8 @@ func createIPK(info *nfpm.Info, ipk *tar.Writer) error { return err } - control, err := newTGZ("control.tar.gz", + control, err := newTGZ( + "control.tar.gz", func(tw *tar.Writer) error { return populateControlTar(info, tw, installSize) }, @@ -199,7 +202,8 @@ func populateDataTar(info *nfpm.Info, tw *tar.Writer) (instSize int64, err error Mode: int64(file.FileInfo.Mode), Uname: file.FileInfo.Owner, Gname: file.FileInfo.Group, - }) + }, + ) case files.TypeSymlink: err = tw.WriteHeader( &tar.Header{ @@ -208,7 +212,8 @@ func populateDataTar(info *nfpm.Info, tw *tar.Writer) (instSize int64, err error Format: tar.FormatGNU, ModTime: modtime.Get(info.MTime), Linkname: file.Source, - }) + }, + ) case files.TypeFile, files.TypeTree, files.TypeConfig, files.TypeConfigNoReplace, files.TypeConfigMissingOK: size, err = writeFile(tw, file) default: diff --git a/rpm/rpm.go b/rpm/rpm.go index fadff25..f24fa81 100644 --- a/rpm/rpm.go +++ b/rpm/rpm.go @@ -77,18 +77,18 @@ type RPM struct { // https://github.com/rpm-software-management/rpm/blob/4a9b7b5908d8b463a836b51322242677677bd8b7/lib/rpmrc.cc#L1167 // nolint: gochecknoglobals var archToRPM = map[string]string{ - "all": "noarch", - "amd64": "x86_64", - "386": "i386", - "arm64": "aarch64", - "arm5": "armv5tel", - "arm6": "armv6hl", - "arm7": "armv7hl", - "mips64le": "mips64el", - "mipsle": "mipsel", - "mips": "mips", - "loong64": "loongarch64", - "riscv64": "riscv64", + "all": "noarch", + "amd64": "x86_64", + "386": "i386", + "arm64": "aarch64", + "arm5": "armv5tel", + "arm6": "armv6hl", + "arm7": "armv7hl", + "mips64le": "mips64el", + "mipsle": "mipsel", + "mips": "mips", + "loong64": "loongarch64", + "riscv64": "riscv64", } func setDefaults(info *nfpm.Info) *nfpm.Info {