Thanks to visit codestin.com
Credit goes to github.com

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
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Continous Integration
on: [push, pull_request]

jobs:
ci:
runs-on: ubuntu-18.04
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Run goimports
run: |
go get golang.org/x/tools/cmd/goimports
output="$($(go env GOPATH)/bin/goimports -l $(find . -type f -name "*.go" -not -path "./vendor/*"))"
test -z $output && exit 0
$(go env GOPATH)/bin/goimports -d .
exit 1
- name: Lint
env:
GOROOT: ""
uses: actions-contrib/golangci-lint@v1
- name: Test
run: go test -v .
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: goreleaser

on:
pull_request:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
goodhosts
goodhosts.exe
.idea
dist
out
release
/goodhosts
/goodhosts.exe
/.idea
/dist
/out
/release
2 changes: 1 addition & 1 deletion cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func add(c *cli.Context) error {
uniqueHosts[args.Slice()[i]] = true
}

for key, _ := range uniqueHosts {
for key := range uniqueHosts {
hostEntries = append(hostEntries, key)
}

Expand Down
6 changes: 4 additions & 2 deletions cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func remove(c *cli.Context) error {
uniqueHosts[args.Slice()[i]] = true
}

for key, _ := range uniqueHosts {
for key := range uniqueHosts {
hostEntries = append(hostEntries, key)
}

Expand All @@ -54,7 +54,9 @@ func remove(c *cli.Context) error {
} else {
hostEntries = append(hostEntries, args.Slice()[0])
for _, value := range hostEntries {
hostsfile.RemoveByHostname(value)
if err := hostsfile.RemoveByHostname(value); err != nil {
return err
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/goodhosts/cli
go 1.13

require (
github.com/goodhosts/hostsfile v0.0.1
github.com/goodhosts/hostsfile v0.0.3
github.com/olekukonko/tablewriter v0.0.4
github.com/sirupsen/logrus v1.4.2
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
Expand Down
298 changes: 296 additions & 2 deletions go.sum

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions vendor/github.com/dimchansky/utfbom/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions vendor/github.com/dimchansky/utfbom/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

201 changes: 201 additions & 0 deletions vendor/github.com/dimchansky/utfbom/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading