jq is useful to slice, filter, map and transform structured json data.
brew install jq
package main | |
import ( | |
"crypto" | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/sha256" | |
"encoding/base64" | |
"testing" | |
) |
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/signal" | |
"github.com/iovisor/gobpf/bcc" | |
) |
package main | |
import ( | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/x509" | |
"crypto/x509/pkix" | |
"encoding/pem" | |
"fmt" | |
"math/big" |
package main | |
import ( | |
"bytes" | |
"exec" | |
"log" | |
"os" | |
) | |
// Pipeline strings together the given exec.Cmd commands in a similar fashion |
# This is the first stage, for building things that will be required by the | |
# final stage (notably the binary) | |
FROM golang | |
# Copy in just the go.mod and go.sum files, and download the dependencies. By | |
# doing this before copying in the other dependencies, the Docker build cache | |
# can skip these steps so long as neither of these two files change. | |
COPY go.mod go.sum ./ | |
RUN go mod download |
# Sample from @citizen428 https://dev.to/citizen428/comment/6cmh | |
FROM golang:alpine as build | |
RUN apk add --no-cache ca-certificates | |
WORKDIR /build | |
ADD . . | |
RUN CGO_ENABLED=0 GOOS=linux \ | |
go build -ldflags '-extldflags "-static"' -o app | |
FROM scratch | |
COPY --from=build /etc/ssl/certs/ca-certificates.crt \ |
package tar_helper | |
import ( | |
"archive/tar" | |
"compress/gzip" | |
"errors" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"os" |
image: gitlab.dev.terastrm.net:4567/terastream/cisco-nso/ci-cisco-nso:4.2.3 | |
stages: | |
- build | |
- mr-robot | |
variables: | |
NCS_VERSION: "4.2.3" | |
DOCKER_REGISTRY: "gitlab.dev.terastrm.net:4567/terastream/cisco-nso" | |
TARGET_REGISTRY: "repo.dev.terastrm.net:5000/" |
This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.
While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.