Skip to content

Commit

Permalink
2018 update (#1)
Browse files Browse the repository at this point in the history
+ add versions
+ add modules
+ add GolangCI lint
* bump Travis
* small refactoring
  • Loading branch information
nezorflame authored Sep 11, 2018
1 parent 7eaf78f commit fa4a901
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
disable:
- megacheck
20 changes: 15 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
dist: trusty
sudo: false
language: go

go:
- 1.7.6
- 1.8.3
- 1.9
- master
- "1.11"
- "tip"
env:
global:
- PATH=$PATH:$HOME/gopath/bin
- GOLANGCI=v1.10.2
- GO111MODULE=on
install:
- go install
before_script:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin $GOLANGCI
script:
- golangci-lint run --enable goimports
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/nezorflame/tuidconv

require github.com/google/uuid v1.0.1-0.20180828181555-e704694aed0e
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.0.1-0.20180828181555-e704694aed0e h1:sogdaggUzugKY5G8mflaq2AzSSGmUPD6Pi6UAZ/ugg0=
github.com/google/uuid v1.0.1-0.20180828181555-e704694aed0e/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,23 @@ func main() {
tuidStr = os.Args[1]
locStr = os.Args[2]
default:
fmt.Println("Incorrect input, please try again")
fmt.Println("Incorrect input")
return
}

here, err := time.LoadLocation(locStr)
if err != nil {
fmt.Println("Can't parse location, please try again")
fmt.Printf("Unable to parse location: %v\n", err)
return
}

tuid, err := uuid.Parse(tuidStr)
if err != nil {
fmt.Println("Can't parse timeuuid, please try again")
fmt.Printf("Unable to parse timeuuid: %v\n", err)
return
}

sec, nsec := tuid.Time().UnixTime()

fmt.Println("time:", time.Unix(sec, nsec).In(here))
fmt.Println("unix:", sec)
}

0 comments on commit fa4a901

Please sign in to comment.