main
Motiejus Jakštys 2021-06-01 09:00:27 +03:00
parent 86b7c30680
commit 3d6f45f81c
5 changed files with 14 additions and 7 deletions

View File

@ -1,11 +1,16 @@
image: alpine/edge image: alpine/edge
packages: packages:
- go - go
- git
- make - make
sources: sources:
- https://git.sr.ht/~motiejus/undocker - https://git.sr.ht/~motiejus/undocker
tasks: tasks:
- setup: |
GOPATH=/usr/local go install honnef.co/go/tools/cmd/staticcheck
- test: | - test: |
make -C undocker coverage.html make -C undocker coverage.html
- lint: |
make -C undocker lint
artifacts: artifacts:
- undocker/coverage.html - undocker/coverage.html

View File

@ -5,7 +5,12 @@ undocker: $(GODEPS)
.PHONY: test .PHONY: test
test: test:
go test -cover ./... go test -race -cover ./...
.PHONY: lint
lint:
staticcheck -f stylish ./...
go vet ./...
.INTERMEDIATE: coverage.out .INTERMEDIATE: coverage.out
coverage.out: $(GODEPS) coverage.out: $(GODEPS)

2
go.mod
View File

@ -1,3 +1,5 @@
module git.sr.ht/~motiejus/undocker module git.sr.ht/~motiejus/undocker
go 1.16 go 1.16
require honnef.co/go/tools v0.2.0 // indirect

View File

@ -31,7 +31,7 @@ func main() {
c := &command{flattener: rootfs.Flatten, Stdout: os.Stdout} c := &command{flattener: rootfs.Flatten, Stdout: os.Stdout}
if err := c.execute(os.Args[1], os.Args[2]); err != nil { if err := c.execute(os.Args[1], os.Args[2]); err != nil {
fmt.Errorf("Error: %v", err) fmt.Printf("Error: %v", err)
os.Exit(1) os.Exit(1)
} }
os.Exit(0) os.Exit(0)

View File

@ -5,7 +5,6 @@ import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -20,10 +19,6 @@ const (
_whPrefix = ".wh." _whPrefix = ".wh."
) )
var (
errBadManifest = errors.New("bad manifest.json")
)
type ( type (
dockerManifestJSON []struct { dockerManifestJSON []struct {
Layers []string `json:"Layers"` Layers []string `json:"Layers"`