Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the directory flag to override the command line and enhance githu… #6

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
26 changes: 23 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: TopNDiskAnalyzer

on:
Expand All @@ -27,3 +24,26 @@ jobs:
- name: Package
run: ./build.sh

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# tag_name: v${{ github.run_number }}
# release_name: Release ${{ github.run_number }}
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./package/**
asset_name: package
asset_content_type: application/octet-stream
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

platforms=("linux/amd64" "linux/386" "darwin/amd64" "windows/amd64" "windows/386")

# Create a package folder if it doesn't exist
mkdir -p package

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
Expand All @@ -13,5 +16,5 @@ do
output_name="tdf.exe"
fi

env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name main.go
env GOOS=$GOOS GOARCH=$GOARCH go build -o package/$output_name main.go
done
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
var topN int
var showHelp bool

flag.StringVar(&dirPath, "dir", ".", "Directory path")
flag.StringVar(&dirPath, "dir", "", "Directory path")
flag.IntVar(&topN, "top", 10, "Number of top items to display")
flag.BoolVar(&showHelp, "help", false, "Show help message")
flag.Parse()
Expand Down
Loading