latest
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Jeffrey Paul 2022-12-08 22:25:30 +04:00
parent d3a92e398b
commit 17ad86642a
11 changed files with 39 additions and 70 deletions

View File

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

2
.gitignore vendored
View File

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

View File

@ -1,18 +1,11 @@
################################################################################ ################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898 #2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################ ################################################################################
FROM sneak/builder:main AS builder FROM sneak/builder:14e59af AS builder
ENV GOPATH /go
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
WORKDIR /build 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 ./Makefile ./.golangci.yml ./go.mod ./go.sum .
COPY ./vendor.tar /build/vendor.tar
COPY ./internal ./internal COPY ./internal ./internal
COPY ./bin/gitrev.sh ./bin/gitrev.sh COPY ./bin/gitrev.sh ./bin/gitrev.sh
COPY ./mfer ./mfer COPY ./mfer ./mfer
@ -22,6 +15,7 @@ ARG GITREV unknown
RUN \ RUN \
cd mfer && go generate . && cd .. && \ cd mfer && go generate . && cd .. && \
GOPACKAGESDEBUG=true golangci-lint run ./... && \ GOPACKAGESDEBUG=true golangci-lint run ./... && \
tar xf vendor.tar && rm vendor.tar && \
make mfer.cmd make mfer.cmd
RUN go mod vendor && tar -c . | zstdmt -19 > /src.tzst RUN go mod vendor && tar -c . | zstdmt -19 > /src.tzst
################################################################################ ################################################################################

View File

@ -58,7 +58,7 @@ lint:
docker: sneak-mfer.$(ARCH).docker.tzst 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 build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer .
docker save sneak/mfer | pv | zstdmt -19 > $@ docker save sneak/mfer | pv | zstdmt -19 > $@
du -sh $@ du -sh $@
@ -66,3 +66,8 @@ sneak-mfer.$(ARCH).docker.tzst: $(SOURCEFILES)
godoc: godoc:
open http://127.0.0.1:6060 open http://127.0.0.1:6060
godoc -http=:6060 godoc -http=:6060
vendor.tar: go.mod go.sum
go mod vendor
tar -c vendor > $@
rm -rf vendor

View File

@ -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/*

View File

@ -5,9 +5,11 @@ import (
"fmt" "fmt"
) )
var ErrMissingMagic = errors.New("missing magic bytes in file") var (
var ErrFileTruncated = errors.New("file/stream is truncated abnormally") ErrMissingMagic = errors.New("missing magic bytes in file")
ErrFileTruncated = errors.New("file/stream is truncated abnormally")
)
func Newf(format string, args ...interface{}) error { func Newf(format string, args ...interface{}) error {
return errors.New(fmt.Sprintf(format, args...)) return fmt.Errorf(format, args...)
} }

View File

@ -0,0 +1,11 @@
package bork
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuild(t *testing.T) {
assert.NotNil(t, ErrMissingMagic)
}

View File

@ -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
View File

@ -0,0 +1,12 @@
package log
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuild(t *testing.T) {
Init()
assert.True(t, true)
}

View File

@ -9,7 +9,6 @@ import (
) )
func TestAPIExample(t *testing.T) { func TestAPIExample(t *testing.T) {
// read from filesystem // read from filesystem
m, err := NewFromFS(&ManifestScanOptions{ m, err := NewFromFS(&ManifestScanOptions{
IgnoreDotfiles: true, IgnoreDotfiles: true,

View File

@ -32,7 +32,7 @@ func init() {
af.WriteFile("/.hidden/hello2.txt", []byte("hello world\n"), 0o755) af.WriteFile("/.hidden/hello2.txt", []byte("hello world\n"), 0o755)
big.MkdirAll("/home/user/Library", 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) big.WriteFile(fmt.Sprintf("/home/user/Library/hello%d.txt", i), []byte("hello world\n"), 0o755)
} }
} }