tidy up panic debug, tidy build
This commit is contained in:
parent
669f320b81
commit
b8c30e87d7
|
@ -25,7 +25,7 @@ files stored in a very complicated directory tree in just 5 minutes.
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Install Go.
|
1. Install Go.
|
||||||
2. Download the binary or do `cd src && go mod tidy && go build`
|
2. Download the binary or do `cd src && ./build.sh`
|
||||||
|
|
||||||
## Use
|
## Use
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,21 @@ type ResponseItem struct {
|
||||||
func NewResponseItem(cacheItem *CacheItem.Item) *ResponseItem {
|
func NewResponseItem(cacheItem *CacheItem.Item) *ResponseItem {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Fatalf("Recovered from panic: %s - %+v - %s", r, cacheItem, debug.Stack())
|
copiedItem := &CacheItem.Item{
|
||||||
|
Path: cacheItem.Path,
|
||||||
|
Name: cacheItem.Name,
|
||||||
|
Size: cacheItem.Size,
|
||||||
|
Extension: cacheItem.Extension,
|
||||||
|
Modified: cacheItem.Modified,
|
||||||
|
Mode: cacheItem.Mode,
|
||||||
|
IsDir: cacheItem.IsDir,
|
||||||
|
IsSymlink: cacheItem.IsSymlink,
|
||||||
|
Cached: cacheItem.Cached,
|
||||||
|
Children: nil,
|
||||||
|
MimeType: cacheItem.MimeType,
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Fatalf("Recovered from panic: %s - %+v - %s", r, copiedItem, debug.Stack())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -8,4 +8,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ../dist
|
mkdir -p ../dist
|
||||||
|
|
||||||
go build -v -trimpath -ldflags "-s -w -X main.VersionDate=$(date -u --iso-8601=minutes) -X main.Version=v$VERSION" -o ../dist/crazyfs
|
go build -v -trimpath -ldflags "-s -w -X main.VersionDate=$(date -u --iso-8601=minutes) -X main.Version=v$VERSION" -o ../dist/crazyfs
|
||||||
|
|
||||||
|
chmod +x ../dist/crazyfs
|
Loading…
Reference in New Issue