Skip to content

Commit

Permalink
Added main test.
Browse files Browse the repository at this point in the history
Trying goxc.
  • Loading branch information
ryanfox1985 committed Jun 20, 2016
1 parent c1a1626 commit 4f71f9f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
15 changes: 15 additions & 0 deletions .goxc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"AppName": "share",
"PackageVersion": "0.0.1",
"ArtifactsDest": "./dist",
"Tasks": [
"go-vet",
"go-fmt",
"go-install",
"go-clean"
],
"ConfigVersion": "0.9",
"Env": [
"SHARE_MODE=release"
]
}
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ matrix:
- go: tip

before_install:
- sudo apt-get install -qy libc6-dev-i386
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- go get github.com/mitchellh/gox
- go get github.com/modocache/gover
- go get github.com/inconshreveable/mousetrap
- go get github.com/laher/goxc
# - sudo apt-get install -qy libc6-dev-i386
# - go get github.com/mitchellh/gox
# - go get github.com/inconshreveable/mousetrap
# - go get github.com/tcnksm/ghr

install:
Expand All @@ -35,6 +36,7 @@ script:
- goveralls -coverprofile=gover.coverprofile -service travis-ci

after_success:
- gox -cgo -output "dist/{{.OS}}_{{.Arch}}_{{.Dir}}"
- goxc
# - gox -cgo -output "dist/{{.OS}}_{{.Arch}}_{{.Dir}}"
# - ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/
# - ghr --username tcnksm-sample --token $GITHUB_TOKEN --replace --prerelease --debug pre-release dist/
17 changes: 13 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/devcows/share/cmd"
"github.com/gin-gonic/gin"
)

func main() {
// Log as JSON instead of the default ASCII formatter.
log.SetFormatter(&log.JSONFormatter{})

// Output to stderr instead of stdout, could also be a file.
log.SetOutput(os.Stderr)
if os.Getenv("SHARE_MODE") == "release" {
// Only log the warning severity or above.
log.SetLevel(log.WarnLevel)
gin.SetMode(gin.ReleaseMode)

// Only log the warning severity or above.
log.SetLevel(log.InfoLevel)
//TODO: Output to file instead of stdout.
//log.SetOutput(os.Stderr)
} else {
log.SetLevel(log.DebugLevel)

// Output to stderr instead of stdout, could also be a file.
log.SetOutput(os.Stderr)
}

if err := cmd.RootCmd.Execute(); err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 4f71f9f

Please sign in to comment.