diff --git a/.gitignore b/.gitignore index 380a4a9..7e5a24a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules *.vsix *.DS_Store artifacts/ +tools/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 930f38e..23c3c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,78 +1,15 @@ - -## 1.0.7 (2021-07-13) +### Version 1.0.7 +- refactor: ➖ remove go-outliner from extension pack -#### Bug Fixes - -* **i:** adjust taskfile for publishing 3e98ebea7de9e51fc8682ec48930583c7170e9ec - - - -## 1.0.6 (2021-07-13) - - -#### Bug Fixes - -* **x:** adjust path for image in package a2913c8c0d87137e2992fc7ea132fb4e9bd402fc - - - -## 1.0.5 (2021-07-13) - - -#### Bug Fixes - -* **i:** remove blocked url badge paths 834f77d987e6492bf5508d66d5f3f51e2ee8a9dd - - - -## 1.0.4 (2021-07-13) - - -#### Bug Fixes - -* **i:** fix gitleaks hook 780f497653cccffa415c2d52f02e56b0c942be2c - - - -## 1.0.3 (2021-07-13) - - -#### Bug Fixes - -* **x:** add missing publisher to manifest 1d7df90f2ecf74094b8f7de8ecb4095fd9b71eed - - - -## 1.0.2 (2021-07-13) - - -* There is no user facing commit in this version - - - -## 1.0.1 (2021-07-13) - - -* There is no user facing commit in this version - - - ## 1.0.0 (2021-07-13) +### Bug Fixes -#### Bug Fixes - -* **e:** add project files and manifest updates b876ec75c7bc8542b427cf8f6b8dc258d5ddb05a -* **t:** initial pack creation 9c500aafbc2c93b995ce7f8bc0dde3ace96cd5e9 - +- **e:** add project files and manifest updates b876ec75c7bc8542b427cf8f6b8dc258d5ddb05a +- **t:** initial pack creation 9c500aafbc2c93b995ce7f8bc0dde3ace96cd5e9 # Change Log All notable changes to the "go-extensions" extension pack will be documented in this file. - Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. - -## [Unreleased] - -- Initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..678b628 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +## Developer Setup + +Setup Mage (requires Go). + +```shell +git clone https://github.com/magefile/mage +cd mage +go run bootstrap.go +``` diff --git a/README.md b/README.md index 8ad8ccc..46e2903 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,15 @@ Extensions for usage with Go development. +## What's Included + +- `go-doc`: Show documentation of go symbols and packages +- `go-struct-tag`: A Visual Studio Code extension for auto complete the go struct tag when typing. +- `vscode-go-inline-sql`: Syntax highlighting for inline sql in go +- `json-to-go`: Convert JSON data to Go struct +- `golang.go`: _The_ extension for Go that makes this all worth it. +- `vscode-go-template`: Go Template Syntax Highlight Support for VSCode. + ## Resources My Go cheatsheet: [docs/go](https://www.sheldonhull.com/docs/go) diff --git a/Taskfile.yml b/Taskfile.yml index 99d6234..e17d060 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,4 +1,7 @@ # https://taskfile.dev +env: + TOOLS_DIRECTORY: 'tools' + GOBIN: '{{ .TOOLS_DIRECTORY }}' version: '3' vars: @@ -14,6 +17,11 @@ tasks: npm_config_loglevel: info cmds: - | + {{if eq OS "windows"}} + powershell.exe -nologo -noexit -c "(New-Item '{{ .TOOLS_DIRECTORY }}' -ItemType Directory -Force).FullName" + {{else}} + mkdir '{{ .TOOLS_DIRECTORY }}' + {{end}} npm install -g yo generator-code npm install -g vsce go install github.com/evilmartians/lefthook@latest diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..126690d --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module extension-pack-go + +go 1.16 + +require ( + github.com/bwplotka/bingo v0.4.3 // indirect + github.com/carolynvs/magex v0.6.0 + github.com/magefile/mage v1.11.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..84c227c --- /dev/null +++ b/go.sum @@ -0,0 +1,77 @@ +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/bwplotka/bingo v0.4.3 h1:lVJ0CU0tRUWue1GP/UyqHtc4ukPvyhKHdk8vJyAPQjs= +github.com/bwplotka/bingo v0.4.3/go.mod h1:I/Km90ZtlRi/romboXtQnuNZ6SAj/uc8bZcvqjUZFKY= +github.com/carolynvs/magex v0.6.0 h1:rzz4RnBiR8hr2WYEsmq+mqkRLEstPnEK8ZP9MgxNY9Y= +github.com/carolynvs/magex v0.6.0/go.mod h1:hqaEkr9TAv+kFb/5wgDiTdszF13rpe0Q+bWHmTe6N74= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= +github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= +github.com/efficientgo/tools/core v0.0.0-20210201220623-8118984754c2 h1:GD19G/vhEa8amDJDBYcTaFXZjxKed67Ev0ZFPHdd/LQ= +github.com/efficientgo/tools/core v0.0.0-20210201220623-8118984754c2/go.mod h1:cFZoHUhKg31xkPnPjhPKFtevnx0Xcg67ptBRxbpaxtk= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/pgzip v1.2.4/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls= +github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXdQbCmeMxwc= +github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/pierrec/lz4/v4 v4.0.3/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7/go.mod h1:zO8QMzTeZd5cpnIkz/Gn6iK0jDfGicM1nynOkkPIl28= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201029080932-201ba4db2418 h1:HlFl4V6pEMziuLXyRkm5BIYq1y1GAbb02pRlWvI54OM= +golang.org/x/sys v0.0.0-20201029080932-201ba4db2418/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20191110171634-ad39bd3f0407 h1:5zh5atpUEdIc478E/ebrIaHLKcfVvG6dL/fGv7BcMoM= +golang.org/x/term v0.0.0-20191110171634-ad39bd3f0407/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +mvdan.cc/editorconfig v0.1.1-0.20200121172147-e40951bde157/go.mod h1:Ge4atmRUYqueGppvJ7JNrtqpqokoJEFxYbP0Z+WeKS8= +mvdan.cc/sh/v3 v3.2.4 h1:+fZaWcXWRjYAvqzEKoDhDM3DkxdDUykU2iw0VMKFe9s= +mvdan.cc/sh/v3 v3.2.4/go.mod h1:fPQmabBpREM/XQ9YXSU5ZFZ/Sm+PmKP9/vkFHgYKJEI= diff --git a/lefthook.semver.yml b/lefthook.semver.yml index 3815eff..7085d41 100644 --- a/lefthook.semver.yml +++ b/lefthook.semver.yml @@ -19,9 +19,9 @@ pre-push: tags: semver name: bump run: | - PRIOR_VERSION=`npm version unchain release echo "unchain: $(git describe --always)" - VERSION=`git describe --always` - npm version $VERSION && echo "bumped npm package version from [$PRIOR_VERSION] to [$VERSION]" - git add . && git commit --amend --no-edit --no-verify + npm version $(git describe --always) + echo "bumped npm package version to [$VERSION]" + git add . + git commit --amend --no-edit --no-verify diff --git a/magefile.go b/magefile.go new file mode 100644 index 0000000..6d7b02c --- /dev/null +++ b/magefile.go @@ -0,0 +1,102 @@ +//+build mage + +package main + +import ( + "fmt" + "os" + "runtime" + "strings" + + "github.com/magefile/mage/mg" + "github.com/magefile/mage/sh" +) + +// allow user to override go executable by running as GOEXE=xxx make ... on unix-like systems +var goexe = "go" + +func init() { + if exe := os.Getenv("GOEXE"); exe != "" { + goexe = exe + } + + // We want to use Go 1.11 modules even if the source lives inside GOPATH. + // The default is "auto". + os.Setenv("GO111MODULE", "on") +} + +// Install all dependencies to local directory +func Build() error { + if err := sh.Run("go", "mod", "download"); err != nil { + return err + } + return sh.Run("go", "install", "./...") +} + +func runCmd(env map[string]string, cmd string, args ...interface{}) error { + if mg.Verbose() { + return runWith(env, cmd, args...) + } + output, err := sh.OutputWith(env, cmd, argsToStrings(args...)...) + if err != nil { + fmt.Fprint(os.Stderr, output) + } + + return err +} + +func runWith(env map[string]string, cmd string, inArgs ...interface{}) error { + s := argsToStrings(inArgs...) + return sh.RunWith(env, cmd, s...) +} + +func isGoLatest() bool { + return strings.Contains(runtime.Version(), "1.16") +} + +func isCI() bool { + return os.Getenv("CI") != "" +} + +func argsToStrings(v ...interface{}) []string { + var args []string + for _, arg := range v { + switch v := arg.(type) { + case string: + if v != "" { + args = append(args, v) + } + case []string: + if v != nil { + args = append(args, v...) + } + default: + panic("invalid type") + } + } + + return args +} + +// Remove the temporarily generated files from Release. +func Clean() error { + return sh.Rm("dist") +} + +// InstallTools installs all the tooling for the project +func InstallTools() error { + cmds := []string{ + "go install github.com/evilmartians/lefthook@latest", + "go install github.com/owenrumney/squealer/cmd/squealer@latest", + "GO111MODULE=on go get github.com/zricethezav/gitleaks/v7", + "go install github.com/hekike/unchain@master", + } + + for _, cmd := range cmds { + if err := sh.Run(cmd); err != nil { + return err + } + } + + return nil +} diff --git a/package.json b/package.json index 18bf1d3..f61c3c8 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "extension-pack-go", - "displayName": "extension-pack-go", + "displayName": "Go Extension Pack for Fellow Gophers", "description": "Standard Go (golang) development extensions by Sheldon Hull (sheldonhull.com)", "publisher": "sheldon-hull", "icon": "gopher-128x128.png", - "version": "0.0.1", + "version": "1.0.7", "engines": { "vscode": "^1.58.0" }, @@ -24,5 +24,10 @@ "repository": { "url": "https://github.com/sheldonhull/extension-pack-go/issues", "type": "git" - } + }, + "keywords": [ + "go", + "golang", + "extension-pack" + ] }