Skip to content

Commit

Permalink
Merge branch 'main' into artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
cugu authored Oct 19, 2024
2 parents 1557dce + caade8d commit 0420047
Show file tree
Hide file tree
Showing 9 changed files with 1,076 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-go@v5
with: { go-version: '1.23' }
- uses: actions/checkout@v4
- run: make install generate-win fmt
- run: make install generate-win fmt_linux
- run: git diff --exit-code

validate:
Expand Down
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ install:
go install mvdan.cc/[email protected]
go install github.com/daixiang0/[email protected]

.PHONY: fmt
fmt:
.PHONY: fmt_darwin
fmt_darwin:
@echo "Formatting..."
go mod tidy
go fmt ./...
gci write -s standard -s default -s "prefix(github.com/forensicanalysis/artifactcollector)" .
gofumpt -l -w .
find . -type f -name "*.go" -print0 | xargs -0 sed -i.bak -e 's/ 0o/ 0/g'
find . -type f -name "*.go" -print0 | xargs -0 sed -i '' -e 's/ 0o/ 0/g'
wsl -fix ./... || true

.PHONY: fmt_linux
fmt_linux:
@echo "Formatting..."
go mod tidy
go fmt ./...
gci write -s standard -s default -s "prefix(github.com/forensicanalysis/artifactcollector)" .
gofumpt -l -w .
find . -type f -name "*.go" -print0 | xargs -0 sed -i -e 's/ 0o/ 0/g'
wsl -fix ./... || true

.PHONY: vendor
Expand Down
4 changes: 2 additions & 2 deletions artifacts/expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"runtime"
"strings"

"github.com/forensicanalysis/fsdoublestar"
"github.com/forensicanalysis/artifactcollector/doublestar"
)

const windows = "windows"
Expand Down Expand Up @@ -231,7 +231,7 @@ func expandPath(fs fs.FS, syspath string, prefixes []string, collector ArtifactC
expandedPath = strings.Replace(expandedPath, "{", `\{`, -1)
expandedPath = strings.Replace(expandedPath, "}", `\}`, -1)

unglobedPaths, err := fsdoublestar.Glob(fs, expandedPath)
unglobedPaths, err := doublestar.Glob(fs, expandedPath)
if err != nil {
log.Println(err)

Expand Down
22 changes: 22 additions & 0 deletions doublestar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Recursive directory globbing via `**` for Go's [io/fs](https://golang.org/pkg/io/fs).

## Example

``` golang
func main() {
// get file system for this repository
wd, _ := os.Getwd()
fsys := os.DirFS(wd)

// get all yml files
matches, _ := fsdoublestar.Glob(fsys, "**/*.yml")

// print matches
fmt.Println(matches)
// Output: [.github/workflows/ci.yml .github/.golangci.yml]
}
```

## Acknowledgement

This repository is based on [Bob Matcuk's](https://github.com/bmatcuk) great [doublestar](https://github.com/bmatcuk/doublestar) package.
Loading

0 comments on commit 0420047

Please sign in to comment.