mirror of
https://github.com/goreleaser/nfpm.git
synced 2026-06-19 08:05:04 +00:00
fix: removed unused context
This commit is contained in:
+2
-7
@@ -1,17 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/caarlos0/pkg"
|
||||
"github.com/caarlos0/pkg/deb"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -23,8 +20,6 @@ var (
|
||||
|
||||
func main() {
|
||||
kingpin.MustParse(app.Parse(os.Args[1:]))
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
defer cancel()
|
||||
|
||||
bts, err := ioutil.ReadFile(*config)
|
||||
kingpin.FatalIfError(err, "")
|
||||
@@ -44,6 +39,6 @@ func main() {
|
||||
|
||||
f, err := os.Create(*target)
|
||||
kingpin.FatalIfError(err, "")
|
||||
kingpin.FatalIfError(packager.Package(ctx, info, f), "")
|
||||
kingpin.FatalIfError(packager.Package(info, f), "")
|
||||
fmt.Println("done:", *target)
|
||||
}
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ import (
|
||||
"archive/tar"
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -27,7 +26,7 @@ var Default = &Deb{}
|
||||
type Deb struct{}
|
||||
|
||||
// Package writes a new deb package to the given writer using the given info
|
||||
func (*Deb) Package(ctx context.Context, info pkg.Info, deb io.Writer) (err error) {
|
||||
func (*Deb) Package(info pkg.Info, deb io.Writer) (err error) {
|
||||
var now = time.Now()
|
||||
dataTarGz, md5sums, instSize, err := createDataTarGz(now, info)
|
||||
if err != nil {
|
||||
|
||||
+5
-8
@@ -1,7 +1,6 @@
|
||||
package deb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
@@ -10,12 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDeb(t *testing.T) {
|
||||
var files = []pkg.File{
|
||||
{Src: "./testdata/fake", Dst: "/usr/local/bin/fake"},
|
||||
{Src: "./testdata/whatever.conf", Dst: "/etc/fake/fake.conf"},
|
||||
}
|
||||
var err = New(
|
||||
context.Background(),
|
||||
var err = Default.Package(
|
||||
pkg.Info{
|
||||
Name: "foo",
|
||||
Arch: "amd64",
|
||||
@@ -29,8 +23,11 @@ func TestDeb(t *testing.T) {
|
||||
Section: "default",
|
||||
Homepage: "http://carlosbecker.com",
|
||||
Vendor: "nope",
|
||||
Files: map[string]string{
|
||||
"./testdata/fake": "/usr/local/bin/fake",
|
||||
"./testdata/whatever.conf": "/etc/fake/fake.conf",
|
||||
},
|
||||
},
|
||||
files,
|
||||
ioutil.Discard,
|
||||
)
|
||||
assert.NoError(t, err)
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
// formats.
|
||||
package pkg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
)
|
||||
import "io"
|
||||
|
||||
// Packager represents any packager implementation
|
||||
type Packager interface {
|
||||
Package(ctx context.Context, info Info, w io.Writer) error
|
||||
Package(info Info, w io.Writer) error
|
||||
}
|
||||
|
||||
// Info contains information about the package
|
||||
|
||||
Reference in New Issue
Block a user