Skip to content

Instantly share code, notes, and snippets.

View Cibernomadas's full-sized avatar

Cibernómadas Cibernomadas

View GitHub Profile
go get -d -u github.com/golang/dep
cd $(go env GOPATH)/src/github.com/golang/dep
DEP_LATEST=$(git describe --abbrev=0 --tags)
git checkout $DEP_LATEST
go install -ldflags="-X main.version=$DEP_LATEST" ./cmd/dep
git checkout master
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
$ dep init
Using ^1.2.0 as constraint for direct dep github.com/gin-gonic/gin
Locking in v1.2 (d459835) for direct dep github.com/gin-gonic/gin
Locking in master (22d885f) for transitive dep github.com/gin-contrib/sse
Locking in v1.1.0 (b4deda0) for transitive dep github.com/golang/protobuf
Locking in v1.1.1 (b4c50a2) for transitive dep github.com/ugorji/go
Locking in v8.18.2 (5f1438d) for transitive dep gopkg.in/go-playground/validator.v8
Locking in v0.0.3 (0360b2a) for transitive dep github.com/mattn/go-isatty
Locking in master (0b6bef9) for transitive dep golang.org/x/sys
Locking in v2.2.1 (5420a8b) for transitive dep gopkg.in/yaml.v2
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/gin-contrib/sse"
packages = ["."]
revision = "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae"
[[projects]]
dep ensure -add gopkg.in/telegram-bot-api.v4
Fetching sources...
"gopkg.in/telegram-bot-api.v4" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.
## [....]
[[constraint]]
name = "github.com/sirupsen/logrus"
version = "v1.0.0"
[prune]
go-tests = true
unused-packages = true
$ dep status
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
github.com/gin-contrib/sse branch master branch master 22d885f 22d885f 1
github.com/gin-gonic/gin ^1.2.0 v1.2 d459835 v1.2 3
github.com/golang/protobuf v1.1.0 v1.1.0 b4deda0 v1.1.0 1
github.com/mattn/go-isatty v0.0.3 v0.0.3 0360b2a v0.0.3 1
github.com/sirupsen/logrus ^1.0.0 v1.0.5 c155da1 v1.0.5 1
github.com/ugorji/go v1.1.1 v1.1.1 b4c50a2 v1.1.1 1
golang.org/x/crypto branch master branch master 1a580b3 75e913e 1
golang.org/x/sys branch master branch master 0b6bef9 77b0e43 2
# Linux
$ sudo apt-get install graphviz
$ dep status -dot | dot -T png | display
# macOS
$ brew install graphviz
$ dep status -dot | dot -T png | open -f -a /Applications/Preview.app
# Windows
> choco install graphviz.portable
.
├── Gopkg.lock
├── Gopkg.toml
├── LICENSE
├── cmd
│   └── goblog
│   └── main.go
├── vendor
└── webapp
├── public
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "¡Hola Mundo!",
})