Skip to content

Instantly share code, notes, and snippets.

ctx := context.Background()
assumecnf, _ := config.LoadDefaultConfig(
ctx, config.WithRegion("{aws-region}"),
config.WithCredentialsProvider(aws.NewCredentialsCache(
credentials.NewStaticCredentialsProvider(
"{aws-assume-role-key}",
"{aws-assume-role-secret}", "",
)),
),
)
rootCmd = &cobra.Command{
Use: "manualrun",
Short: "trigger a manual run",
Long: func() string {
var b bytes.Buffer
wb := bufio.NewWriter(&b)
h := tabwriter.NewWriter(wb, 0, 10, 5, ' ', 0)
fmt.Fprintf(h, "Trigger a manual run, among other tools.\n\n")
fmt.Fprintf(h, "Format for the --input flag:\n")
fmt.Fprintf(h, " payer:<id>[/link1,link2,...]\trun manual calculation at payer level, optional acct list is for log filtering\n")
package main
import (
goflag "flag"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"k8s.io/klog"
)
package main
import (
goflag "flag"
"github.com/golang/glog"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)
import (
...
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
compute "google.golang.org/api/compute/v1"
deploymentmgr "google.golang.org/api/deploymentmanager/v2"
)
func main() {
// Error checks are discarded for brevity.
package main
import (
goflag "flag"
"github.com/golang/glog"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)
<?xml version='1.0' encoding='utf-8'?>
<providers>
<provider level="5" ID="a3693192-9ed6-46d2-a981-f8226c8363bd" >
<keyword ID="0xF"/>
</provider>
</providers>
FROM golang:1.8.3-nanoserver
ADD . /go/src/demoapp
WORKDIR /go/src/demoapp
RUN go build -v
ENTRYPOINT ["/go/src/demoapp/demoapp"]
package main
import (
"log"
"time"
)
func main() {
log.SetFlags(0)
@flowerinthenight
flowerinthenight / blog_go_json_prettifier.go
Created September 5, 2017 14:33
JSON prettifier function in Go
var Pad int = 2
func Indent(count int) string {
pad := ""
for i := 0; i < count; i++ {
pad += " "
}
return pad
}