-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version and updated README.md with the required details. (#20)
1. Added support to check for version as well -help falg to print usage. 2. Created README.md with minimum required details possible.
- Loading branch information
1 parent
def385a
commit 731a9c1
Showing
3 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,11 @@ jobs: | |
echo "The current tag is: ${{ steps.taggerDryRun.outputs.tag }}" | ||
- name: Build | ||
run: | | ||
GOOS=linux GOARCH=amd64 go build -o build/goastgen-linux | ||
GOOS=linux GOARCH=arm64 go build -o build/goastgen-linux-arm64 | ||
GOOS=windows GOARCH=amd64 go build -o build/goastgen-windows.exe | ||
GOOS=darwin GOARCH=amd64 go build -o build/goastgen-macos | ||
GOOS=darwin GOARCH=arm64 go build -o build/goastgen-macos-arm64 | ||
GOOS=linux GOARCH=amd64 go build -o build/goastgen-linux -ldflags "-X main.Version=${{ steps.taggerDryRun.outputs.tag }}" | ||
GOOS=linux GOARCH=arm64 go build -o build/goastgen-linux-arm64 -ldflags "-X main.Version=${{ steps.taggerDryRun.outputs.tag }}" | ||
GOOS=windows GOARCH=amd64 go build -o build/goastgen-windows.exe -ldflags "-X main.Version=${{ steps.taggerDryRun.outputs.tag }}" | ||
GOOS=darwin GOARCH=amd64 go build -o build/goastgen-macos -ldflags "-X main.Version=${{ steps.taggerDryRun.outputs.tag }}" | ||
GOOS=darwin GOARCH=arm64 go build -o build/goastgen-macos-arm64 -ldflags "-X main.Version=${{ steps.taggerDryRun.outputs.tag }}" | ||
- name: Set next release version | ||
id: taggerFinal | ||
uses: anothrNick/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# AST generator | ||
|
||
This utility generates Abstract Syntax Tree (AST) for .go files in JSON format. | ||
|
||
If you pass the root folder of the go project, it will iterate through all `.go` files from project directory | ||
and generate ast in JSON format for each `.go` file. | ||
|
||
## Usage | ||
|
||
## Building | ||
|
||
Run below command from within root folder of the cloned repository. | ||
|
||
```bash | ||
go build -o build/goastgen | ||
``` | ||
|
||
This will generate native binary for your local machine inside `build` folder | ||
|
||
## Getting Help | ||
|
||
```bash | ||
build/goastgen -help | ||
|
||
Usage: | ||
goastgen [falgs] <source location> | ||
|
||
Flags: | ||
-help | ||
print the usage | ||
-out string | ||
Out put location of ast (default ".ast") | ||
-version | ||
print the version | ||
``` | ||
|
||
## Example | ||
|
||
### Single file | ||
1. Generate AST with single `.go` file path without passing `-out` flag to indicate ast json out location. | ||
|
||
```bash | ||
$ goastgen <filepath>/<go filename> | ||
|
||
e.g | ||
$ goastgen /path/src/hello.go | ||
|
||
It should generate the AST in JSON format at | ||
|
||
/path/src/.ast/hello.go.json | ||
``` | ||
|
||
2. Generate AST with single `.go` file with `-out` flag | ||
|
||
```bash | ||
$ goastgen -out <output location> <filepath>/<go filename> | ||
|
||
e.g | ||
$ goastgen -out /tmp/randompath /path/src/hello.go | ||
|
||
It should generate the AST in JSON format at | ||
|
||
/tmp/randompath/hello.go.json | ||
``` | ||
|
||
### Complete project directory | ||
|
||
```bash | ||
/path/repository | ||
- hello.go | ||
- anotherfile.go | ||
- somepkg | ||
- somelib.go | ||
``` | ||
1. Generate AST with above root directory of the go project without passing `-out` flag | ||
```bash | ||
$ goastgen <root directory location of go project> | ||
|
||
e.g. | ||
$ goastgen /path/repository | ||
|
||
It should generate AST in JSON fromat for each .go file at following location | ||
|
||
/path/repository/.ast | ||
- hello.go.json | ||
- anotherfile.go.json | ||
- somepkg | ||
- somelib.go.json | ||
``` | ||
|
||
2. Generate AST with above root directory of the go project with `-out` flag | ||
|
||
```bash | ||
$ goastgen -out <output location> <root directory location of go project> | ||
|
||
e.g. | ||
$ goastgen -out /temp/out/ /path/repository | ||
|
||
It should generate AST in JSON fromat for each .go file at following location | ||
|
||
/temp/out/ | ||
- hello.go.json | ||
- anotherfile.go.json | ||
- somepkg | ||
- somelib.go.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters