latest

pull/5/head
Jeffrey Paul 1 year ago
parent d3a92e398b
commit 17ad86642a
  1. 1
      .dockerignore
  2. 2
      .gitignore
  3. 12
      Dockerfile
  4. 7
      Makefile
  5. 21
      buildimage/Dockerfile
  6. 8
      internal/bork/error.go
  7. 11
      internal/bork/error_test.go
  8. 32
      internal/cli/misc.go
  9. 12
      internal/log/log_test.go
  10. 1
      mfer/example_test.go
  11. 2
      mfer/mfer_test.go

@ -1,5 +1,4 @@
*.tzst
*.tar
/buildimage
/dockerdeps
/tmp

2
.gitignore vendored

@ -1,8 +1,8 @@
mfer/*.pb.go
/mfer.cmd
vendor
/tmp
*.tmp
*.docker.tzst
*.tzst
/builddeps/modcache.tar
/vendor

@ -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
################################################################################

@ -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...)
}

@ -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[:]))
}
}
}

@ -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…
Cancel
Save