Files required:
.
├── gen.go
├── generator
│ └── gen.go
Running go generator
will cause a main.go
file to be created in the root directory.
Files required:
.
├── gen.go
├── generator
│ └── gen.go
Running go generator
will cause a main.go
file to be created in the root directory.
# note: the install steps presume you're using go 1.16 or newer. | |
go install github.com/go-delve/delve/cmd/dlv@latest | |
# dependencies required: | |
# | |
# xcode-select --install | |
# sudo /usr/sbin/DevToolsSecurity -enable | |
# | |
# see https://github.com/go-delve/delve/tree/master/Documentation/installation for details |
:echo winnr('$') | |
:echo bufnr('$') | |
:echo tabpagenr('$') |
#!/usr/bin/env bash | |
languages=("bash" "go" "javascript" "php" "python" "ruby" "rust" "typescript-fetch") | |
for lang in "${languages[@]}"; | |
do | |
for filename in .source-cache/.api-documentation/schemas/*; | |
do | |
name=$(basename $filename | cut -f 1 -d '.') | |
openapi-generator generate --skip-validate-spec -i "${filename}" -g "${lang}" -o "/tmp/api-code-gen/${lang}/${name}/" |
:read !cat % | python -m json.tool |
export TF_CLI_CONFIG_FILE=/example-project/dev.tfrc
NOTE: if you use
~/
instead of an absolute path, then be sure your shell expands it to an absolute path (e.g.echo $TF_CLI_CONFIG_FILE
should show the absolute path).
The dev.tfrc
file:
As of Go version 1.16
the go
command changed behaviour for get
and install
:
install
: the recommended way to install packages (ignoringget
: adds dependencies to your project's go modules file (i.e. go.mod
).The go install
command now accepts a version suffix:
test: | |
strategy: | |
matrix: | |
go-version: [1.14.x] | |
node-version: [12] | |
rust-toolchain: [1.46.0] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code |
package main | |
import ( | |
"fmt" | |
"os" | |
"runtime" | |
) | |
/* | |
Goexit terminates the goroutine that calls it. No other goroutine is affected. Goexit runs all deferred calls before terminating the goroutine. Because Goexit is not a panic, any recover calls in those deferred functions will return nil. |
// makeDirectoryIfNotExists asserts whether a directory exists and makes it | |
// if not. Returns nil if exists or successfully made. | |
func makeDirectoryIfNotExists(path string) error { | |
fi, err := os.Stat(path) | |
switch { | |
case err == nil && fi.IsDir(): | |
return nil | |
case err == nil && !fi.IsDir(): | |
return fmt.Errorf("%s already exists as a regular file", path) | |
case os.IsNotExist(err): |