Check if file listing is a directory, verbose build

This commit is contained in:
DataHoarder 2022-01-19 16:40:20 +01:00
parent 18fbe7d340
commit 672d102d46
3 changed files with 12 additions and 3 deletions

View file

@ -7,6 +7,6 @@ steps:
- name: backend
image: golang:1.18-rc-bullseye
commands:
- go build -o srg .
- GOAMD64=v2 go build -v -o srg .
...

View file

@ -1,9 +1,9 @@
FROM golang:1.17-bullseye
FROM golang:1.18-rc-bullseye
COPY . /src
WORKDIR /src
RUN go build -o srg . && mv srg /usr/bin && rm -rf /src
RUN GOAMD64=v2 go build -v -o srg . && mv srg /usr/bin && rm -rf /src
WORKDIR /
ENTRYPOINT ["/usr/bin/srg"]

View file

@ -35,6 +35,15 @@ func HashFile(results chan<- HashFileResult, md5hasher *md5simd.Hasher, sha256ha
}
return
}
if fi.IsDir() {
results <- HashFileResult{
Error: fmt.Errorf("path %s is a directory", path),
Path: path,
}
return
}
fh, err := os.Open(path)
if err != nil {
results <- HashFileResult{