next #5
@ -1,5 +1,4 @@
|
||||
*.tzst
|
||||
*.tar
|
||||
/buildimage
|
||||
/dockerdeps
|
||||
/tmp
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,8 +1,8 @@
|
||||
mfer/*.pb.go
|
||||
/mfer.cmd
|
||||
vendor
|
||||
/tmp
|
||||
*.tmp
|
||||
*.docker.tzst
|
||||
*.tzst
|
||||
/builddeps/modcache.tar
|
||||
/vendor
|
||||
|
12
Dockerfile
12
Dockerfile
@ -1,18 +1,11 @@
|
||||
################################################################################
|
||||
#2345678911234567892123456789312345678941234567895123456789612345678971234567898
|
||||
################################################################################
|
||||
FROM sneak/builder:main AS builder
|
||||
ENV GOPATH /go
|
||||
FROM sneak/builder:14e59af AS builder
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
WORKDIR /build
|
||||
COPY ./go.mod ./go.sum .
|
||||
RUN \
|
||||
go mod download -x
|
||||
################################################################################
|
||||
#### caching phase done
|
||||
################################################################################
|
||||
WORKDIR /build
|
||||
COPY ./Makefile ./.golangci.yml ./go.mod ./go.sum .
|
||||
COPY ./vendor.tar /build/vendor.tar
|
||||
COPY ./internal ./internal
|
||||
COPY ./bin/gitrev.sh ./bin/gitrev.sh
|
||||
COPY ./mfer ./mfer
|
||||
@ -22,6 +15,7 @@ ARG GITREV unknown
|
||||
RUN \
|
||||
cd mfer && go generate . && cd .. && \
|
||||
GOPACKAGESDEBUG=true golangci-lint run ./... && \
|
||||
tar xf vendor.tar && rm vendor.tar && \
|
||||
make mfer.cmd
|
||||
RUN go mod vendor && tar -c . | zstdmt -19 > /src.tzst
|
||||
################################################################################
|
||||
|
7
Makefile
7
Makefile
@ -58,7 +58,7 @@ lint:
|
||||
|
||||
docker: sneak-mfer.$(ARCH).docker.tzst
|
||||
|
||||
sneak-mfer.$(ARCH).docker.tzst: $(SOURCEFILES)
|
||||
sneak-mfer.$(ARCH).docker.tzst: $(SOURCEFILES) vendor.tar
|
||||
docker build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer .
|
||||
docker save sneak/mfer | pv | zstdmt -19 > $@
|
||||
du -sh $@
|
||||
@ -66,3 +66,8 @@ sneak-mfer.$(ARCH).docker.tzst: $(SOURCEFILES)
|
||||
godoc:
|
||||
open http://127.0.0.1:6060
|
||||
godoc -http=:6060
|
||||
|
||||
vendor.tar: go.mod go.sum
|
||||
go mod vendor
|
||||
tar -c vendor > $@
|
||||
rm -rf vendor
|
||||
|
@ -1,21 +0,0 @@
|
||||
## build image:
|
||||
FROM golang:1.19.3-bullseye AS builder
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt update && apt install -y make bzip2 curl unzip
|
||||
RUN mkdir -p /build
|
||||
WORKDIR /build
|
||||
|
||||
# install newer protoc
|
||||
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v21.10/protoc-21.10-linux-aarch_64.zip && \
|
||||
unzip *.zip -d /usr/local && rm -v *.zip && protoc --version
|
||||
|
||||
RUN go install -v google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1
|
||||
|
||||
RUN go env
|
||||
|
||||
COPY ./go.mod .
|
||||
COPY ./go.sum .
|
||||
|
||||
RUN --mount=type=cache,target=/go/pkg go mod download -x
|
||||
RUN rm -rfv /var/cache/* /var/tmp/*
|
@ -5,9 +5,11 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var ErrMissingMagic = errors.New("missing magic bytes in file")
|
||||
var ErrFileTruncated = errors.New("file/stream is truncated abnormally")
|
||||
var (
|
||||
ErrMissingMagic = errors.New("missing magic bytes in file")
|
||||
ErrFileTruncated = errors.New("file/stream is truncated abnormally")
|
||||
)
|
||||
|
||||
func Newf(format string, args ...interface{}) error {
|
||||
return errors.New(fmt.Sprintf(format, args...))
|
||||
return fmt.Errorf(format, args...)
|
||||
}
|
||||
|
11
internal/bork/error_test.go
Normal file
11
internal/bork/error_test.go
Normal file
@ -0,0 +1,11 @@
|
||||
package bork
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
assert.NotNil(t, ErrMissingMagic)
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package cli
|
||||
|
||||
import "fmt"
|
||||
|
||||
// FIXME make this write to a bytes.Buffer with fprintf
|
||||
func DumpByteSlice(b []byte) {
|
||||
var a [16]byte
|
||||
n := (len(b) + 15) &^ 15
|
||||
for i := 0; i < n; i++ {
|
||||
if i%16 == 0 {
|
||||
fmt.Printf("%4d", i)
|
||||
}
|
||||
if i%8 == 0 {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
if i < len(b) {
|
||||
fmt.Printf(" %02X", b[i])
|
||||
} else {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
if i >= len(b) {
|
||||
a[i%16] = ' '
|
||||
} else if b[i] < 32 || b[i] > 126 {
|
||||
a[i%16] = '.'
|
||||
} else {
|
||||
a[i%16] = b[i]
|
||||
}
|
||||
if i%16 == 15 {
|
||||
fmt.Printf(" %s\n", string(a[:]))
|
||||
}
|
||||
}
|
||||
}
|
12
internal/log/log_test.go
Normal file
12
internal/log/log_test.go
Normal file
@ -0,0 +1,12 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
Init()
|
||||
assert.True(t, true)
|
||||
}
|
@ -9,7 +9,6 @@ import (
|
||||
)
|
||||
|
||||
func TestAPIExample(t *testing.T) {
|
||||
|
||||
// read from filesystem
|
||||
m, err := NewFromFS(&ManifestScanOptions{
|
||||
IgnoreDotfiles: true,
|
||||
|
@ -32,7 +32,7 @@ func init() {
|
||||
af.WriteFile("/.hidden/hello2.txt", []byte("hello world\n"), 0o755)
|
||||
|
||||
big.MkdirAll("/home/user/Library", 0o755)
|
||||
for i, _ := range [25]int{} {
|
||||
for i := range [25]int{} {
|
||||
big.WriteFile(fmt.Sprintf("/home/user/Library/hello%d.txt", i), []byte("hello world\n"), 0o755)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user