Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
with:
go-version: stable

- name: gofmt
run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }

- name: Build
env:
CGO_ENABLED: '0'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
env:
CGO_ENABLED: '0'
run: |
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.Version=$GITHUB_REF_NAME" -o goofys-amd64 .
GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.Version=$GITHUB_REF_NAME" -o goofys-arm64 .
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.Version=$GITHUB_REF_NAME -X github.com/kahing/goofys/internal.VersionNumber=${GITHUB_REF_NAME#v}" -o goofys-amd64 .
GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.Version=$GITHUB_REF_NAME -X github.com/kahing/goofys/internal.VersionNumber=${GITHUB_REF_NAME#v}" -o goofys-arm64 .
cp goofys-amd64 goofys

- name: Create release and upload assets
Expand Down
17 changes: 5 additions & 12 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ func kill(pid int, s os.Signal) (err error) {
return
}

// Mount the file system based on the supplied arguments, returning a
// fuse.MountedFileSystem that can be joined to wait for unmounting.
func mount(
ctx context.Context,
bucketName string,
flags *FlagStorage) (fs *Goofys, mfs *fuse.MountedFileSystem, err error) {

return goofys.Mount(ctx, bucketName, flags)
}

func massagePath() {
for _, e := range os.Environ() {
if strings.HasPrefix(e, "PATH=") {
Expand Down Expand Up @@ -142,7 +132,10 @@ func massageArg0() {
// binaries can embed goofys and dispatch to it; note it may daemonize by
// re-executing os.Args[0] and can terminate the process on fatal errors.
func Run(args []string, versionHash string) int {
VersionNumber = "0.25.0"
// release builds stamp internal.VersionNumber from the tag via ldflags
if VersionNumber == "" {
VersionNumber = "0.0.0-dev"
}
VersionHash = versionHash

massagePath()
Expand Down Expand Up @@ -213,7 +206,7 @@ func Run(args []string, versionHash string) int {
// Mount the file system.
var mfs *fuse.MountedFileSystem
var fs *Goofys
fs, mfs, err = mount(
fs, mfs, err = goofys.Mount(
context.Background(),
bucketName,
flags)
Expand Down
2 changes: 1 addition & 1 deletion example/test_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
goofys "github.com/kahing/goofys/api"
common "github.com/kahing/goofys/api/common"

"fmt"
"context"
"fmt"
)

func main() {
Expand Down
14 changes: 7 additions & 7 deletions internal/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ type MakeBucketOutput struct {
RequestId string
}

/// Implementations of all the functions here are expected to be
/// concurrency-safe, except for
///
/// Init() is called exactly once before any other functions are
/// called.
///
/// Capabilities()/Bucket() are expected to be const
// / Implementations of all the functions here are expected to be
// / concurrency-safe, except for
// /
// / Init() is called exactly once before any other functions are
// / called.
// /
// / Capabilities()/Bucket() are expected to be const
type StorageBackend interface {
Init(key string) error
Capabilities() *Capabilities
Expand Down
10 changes: 5 additions & 5 deletions internal/goofys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ func (t *GoofysTest) deleteBlobsParallelly(cloud StorageBackend, blobs []string)
// groupByDecresingDepths takes a slice of path strings and returns the paths as
// groups where each group has the same `depth` - depth(a/b/c)=2, depth(a/b/)=1
// The groups are returned in decreasing order of depths.
// - Inp: [] Out: []
// - Inp: ["a/b1/", "a/b/c1", "a/b2", "a/b/c2"]
// Out: [["a/b/c1", "a/b/c2"], ["a/b1/", "a/b2"]]
// - Inp: ["a/b1/", "z/a/b/c1", "a/b2", "z/a/b/c2"]
// Out: [["z/a/b/c1", "z/a/b/c2"], ["a/b1/", "a/b2"]
// - Inp: [] Out: []
// - Inp: ["a/b1/", "a/b/c1", "a/b2", "a/b/c2"]
// Out: [["a/b/c1", "a/b/c2"], ["a/b1/", "a/b2"]]
// - Inp: ["a/b1/", "z/a/b/c1", "a/b2", "z/a/b/c2"]
// Out: [["z/a/b/c1", "z/a/b/c2"], ["a/b1/", "a/b2"]
func groupByDecresingDepths(items []string) [][]string {
depthToGroup := map[int][]string{}
for _, item := range items {
Expand Down
2 changes: 1 addition & 1 deletion internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,4 @@ func ConvertBytesToIEC(size int64) string {
exp += 1
}
return fmt.Sprintf("%.1f %ciB", curSize, "KMGTPEZY"[exp-1])
}
}
Loading