Skip to content

Commit

Permalink
v0.1.0 Release changes (#7)
Browse files Browse the repository at this point in the history
* refactor code

* complete refactor

* Update errors and fix lint

* Add graceful exit on command line signals

* Add GoReleaser config

Signed-off-by: Azunna Ikonne <[email protected]>
  • Loading branch information
1azunna authored May 30, 2022
1 parent dfc7055 commit 24e46b9
Show file tree
Hide file tree
Showing 40 changed files with 821 additions and 639 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://dl.google.com/go/go1.17.6.linux-amd64.tar.gz"
project_path: "./cmd/zapgo"
project_path: "."
binary_name: "zapgo"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# Dependency directories (remove the comment below to include it)
# vendor/

# zapggo binary
/bin
zapgo
#zapgo test files
zap.log
zap-report*
Expand Down
10 changes: 8 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ issues:
- text: "G107: Potential HTTP request made with variable url"
linters:
- gosec
- text: "composites: `github.com/1azunna/zapgo/internal/zapgo.Zapgo` composite literal uses unkeyed fields"
- text: "G304: Potential file inclusion via variable"
linters:
- govet
- gosec
- text: "composites: `github.com/1azunna/zapgo/internal/docker.Docker` composite literal uses unkeyed fields"
linters:
- govet
- text: "SA5008: duplicate struct tag \"choice\""
linters:
- staticcheck
6 changes: 6 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
builds:
- flags:
- -tags={{.Tag}}
- -v
- ldflags:
- -s -w -X main.version={{.Version}} -X main.date={{.Date}}
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,29 @@ This package was created to make it easy for developers to perform dynamic appli

- Ensure docker is installed. If running in CI environment, ensure there is support for docker in docker.


### Using Go (Recommended)

```
go install github.com/1azunna/zapgo@latest
```

### Github Release

See [Releases](https://github.com/1azunna/zapgo/releases)

Using Wget

```bash
wget -qO- https://github.com/1azunna/zapgo/releases/download/v0.0.1/zapgo-v0.0.1-<OS>-<Arch>.tar.gz | tar -xvzf - -C .
wget -qO- https://github.com/1azunna/zapgo/releases/download/v0.1.0/zapgo-v0.1.0-<OS>-<Arch>.tar.gz | tar -xvzf - -C .
mv ./zapgo /usr/local/bin/zapgo
chmod +x /usr/local/bin/zapgo

```

Using Curl
```bash
curl -sSfL https://github.com/1azunna/zapgo/releases/download/v0.0.1/zapgo-v0.0.1-<OS>-<Arch>.tar.gz | tar -xvzf - -C .
curl -sSfL https://github.com/1azunna/zapgo/releases/download/v0.1.0/zapgo-v0.1.0-<OS>-<Arch>.tar.gz | tar -xvzf - -C .
mv ./zapgo /usr/local/bin/zapgo
chmod +x /usr/local/bin/zapgo
```
Expand Down
40 changes: 40 additions & 0 deletions arguments/arguments.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package arguments

import (
"fmt"
"os"

"github.com/jessevdk/go-flags"
)

type cmdArgs struct {
// Example of verbosity with level
Verbose []bool `short:"v" long:"verbose" description:"Show verbose output"`
Release string `long:"release" choice:"stable" choice:"weekly" choice:"live" choice:"bare" default:"stable" description:"The docker image tag to use"`
Port *int `long:"port" default:"8080" description:"Initialize ZAP with a custom port."`
Pull bool `short:"p" long:"pull" description:"Pull the latest ZAP image from dockerhub"`
Configs []string `long:"opts" description:"Additional ZAP command line options to use when initializing ZAP"`
}

var Options cmdArgs
var Parser = flags.NewParser(&Options, flags.Default)

func CheckArgs() {
introtext := `ZapGo is a command line utility for dynamic security testing based on the OWASP ZAP Project.
See zapgo --help for usage details.`

if _, err := Parser.Parse(); err != nil {
if len(os.Args) == 1 {
fmt.Println(introtext)
}
switch flagsErr := err.(type) {
case flags.ErrorType:
if flagsErr == flags.ErrHelp {
os.Exit(0)
}
os.Exit(1)
default:
os.Exit(1)
}
}
}
43 changes: 0 additions & 43 deletions cmd/zapgo/clean.go

This file was deleted.

45 changes: 0 additions & 45 deletions cmd/zapgo/init.go

This file was deleted.

109 changes: 0 additions & 109 deletions cmd/zapgo/main.go

This file was deleted.

Loading

0 comments on commit 24e46b9

Please sign in to comment.