blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
20d0fc4709307793d5bafeb9b36a8b604bd1df8b | cbfc5e0f95aa6e7b97beef702d73ab593664dd86 | nknorg/nkn | /chain/store/stateGenerator.go | Go | go | 10,593 | permissive | package store
import (
"context"
"errors"
"fmt"
"github.com/nknorg/nkn/v2/block"
"github.com/nknorg/nkn/v2/chain"
"github.com/nknorg/nkn/v2/common"
"github.com/nknorg/nkn/v2/config"
"github.com/nknorg/nkn/v2/crypto"
"github.com/nknorg/nkn/v2/pb"
"github.com/nknorg/nkn/v2/program"
"github.com/nknorg/nkn/v2/... |
fe9234c102280dc1921fe0e2910eb4cb63b9ba37 | d7dcd069145ca6909e24ecb3f22d622c2b2c3954 | a-c-ting/Advent-of-Code | /2019/Day05Part2.go | Go | go | 4,209 | no_license | package main
import (
"fmt"
"io/ioutil"
"strconv"
"strings"
)
const MAX_MODES = 3
type opcodeModes struct {
opcode int
mode [MAX_MODES]int
}
func main() {
Intcode := getIntcodeFromInput("Day05Part1.txt")
processIntcode(Intcode)
}
func processIntcode(intcode []int) {
codeLength := len(intcode)
p1pos, p... |
e4c5a2f4ba5e7aa9997f37e5491dc452f181832c | 2d5fca18da09aa3181eda660613f306339a4bae5 | xhaoxiong/go-wyy | /service/encrypt/encrypt.go | Go | go | 3,056 | no_license | package encrypt
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"fmt"
"math/big"
"math/rand"
)
const modulus = "00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575... |
c98037d89c630b4d0b71d592085ec2ef136c1846 | 93554a8628173ffafe281f63ad049e9cadfeba0f | liuhaobupt/mit6.824 | /src/kvpaxos/server.go | Go | go | 5,286 | no_license | package kvpaxos
import "net"
import "fmt"
import "net/rpc"
import "log"
import "paxos"
import "sync"
import "sync/atomic"
import "os"
import "syscall"
import "encoding/gob"
import "math/rand"
import "time"
const Debug = 0
func DPrintf(format string, a ...interface{}) (n int, err error) {
if Debug > 0 {
log.Printf... |
e454a0f1572360c21285cfff0bf329cb1a58c00b | 660e09927a83794a90f8ce7963144403901829e8 | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/network/v20170301/virtualNetworkPeering.go | Go | go | 13,528 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20170301
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Peerings in a virtual network resource.
type Vir... |
fb8913e4094a04f3070481b8678769148853be45 | 00e2950c8a3ee230baaf4e102a1544310ad55d6e | DAD-Chain/dad-go | /cli/test/test.go | Go | go | 5,298 | no_license | /*
* Copyright (C) 2018 The dad-go Authors
* This file is part of The dad-go library.
*
* The dad-go is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your... |
990330bfc113eb4b1bf182637059c879d9407c33 | 88903b4e6e4550bdd06a27d84bcb6efb8c34e521 | phanminhnhan/WeatherAPI | /main.go | Go | go | 201 | no_license | package main
import(
"github.com/labstack/echo"
handlerFunc"Weather_api/Handler"
)
func main(){
e := echo.New()
e.POST("api/weather", handlerFunc.Temperature )
e.Logger.Fatal(e.Start(":8888"))
} |
d72b1611a1ec2c4e0d8b0eb9108247150dc6faeb | 8c28a21c1a859f38f8b1ec4747507642ef518ebd | xingsu56/teleport | /lib/auth/grpclog.go | Go | go | 3,957 | permissive | /*
Copyright 2018 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
4be9120beb301ccd4029ce4690822125f372ed4f | 6eac6b6bf76247161e2cea7b49ac8feb6df77a89 | mchirico/ci | /static/static.go | Go | go | 233 | permissive | package static
import "strings"
func notes() string {
s := `## Reference
Run the following command:
<trip>bash
./run_ci.sh
<trip>
}
`
return strings.ReplaceAll(s, "<trip>", "```")
}
func Notes() string {
return notes()
}
|
c44fbd5d643bf8d22b507b8a7a6f4fb79b068be6 | d1a51c50d96798713d4ad3f38979980108ac2754 | iamckn/go | /modules/shodan/shodan/host.go | Go | go | 1,409 | no_license | package shodan
import (
"encoding/json"
"fmt"
"net/http"
)
type HostLocation struct {
City string `json:"city"`
RegionCode string `json:"region_code"`
AreaCode int `json:"area_code"`
Longitude float32 `json:"longitude"`
CountryCode3 string `json:"country_code3"`
CountryName string `... |
4ad525d67057c965349a1608dc9a77cd1b6c9a09 | d5cf63bd407bf0db349d88c50eb68895d40e39cd | tongtongyin/Go- | /gogogogo/node.go | Go | go | 2,511 | no_license | /*
go语言仅支持封装,不支持继承和多态
没有class,只有struct
*/
/*
要改变内容必须使用指针接收者
结构过大也考虑使用指针接收者(性能问题)
一致性:如有指针接收者,最好都是指针接收者
值接收者是go语言特有
值/指针 接收者均可接收 值/指针
*/
package main
import "fmt"
type treeNode struct {
value int
left, right *treeNode
}
// 给结构体定义方法
// (node treeNode) 接收者
// 调用该方法时,可以通过treNode实例来.print
func (node treeNode) pri... |
642087da4486e6c28cfe8f61c5205371de246f6c | 49aef27fa4ce218b457b2c86c009ae52850b90cd | vietwow/test | /server/main.go | Go | go | 6,141 | no_license | package main
import (
"bytes"
"context"
"io/ioutil"
"log"
"net"
"os"
"os/signal"
"time"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"github.com/go-pg/pg"
"github.com/go-pg/pg/orm"
pb "github.com/vietwow/test/pb"
uuid "github.com/satori/go.uuid"
)
const (
port ... |
a27b4a7646be48635c6e5302a80877dcdcd9d43c | 50892df51fe1356756ae5384f599254698a86661 | danielc103/registry-secret | /cmd/generate.go | Go | go | 1,945 | permissive | /*
Copyright © 2020 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
59ddb3cc9f9dc45f9c8b3ce192b751d499958786 | 01b8494f2ca0645fb4f5c7000a1bd51c059030ba | l-vitaly/go-transport-generator | /pkg/render/httpserver/transport.go | Go | go | 10,830 | permissive | package httpserver
import (
"os"
"os/exec"
"path"
"strings"
"text/template"
"github.com/pkg/errors"
"github.com/wildberries-ru/go-transport-generator/pkg/api"
)
const serverTransportTpl = `// Package {{.PkgName}} ...
// CODE GENERATED AUTOMATICALLY
// DO NOT EDIT
package {{.PkgName}}
{{$methods := .HTTPMetho... |
9398017461f0362ca651efbe947b56165575118e | 43c41a19c88a890752bac9e57053ecdd892a978d | lizhenyu0128/gm-grpc | /benchmark/benchmark17_test.go | Go | go | 2,781 | permissive | // +build go1.7
/*
*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applic... |
2925d2a4d30aaffee443afdcd4a618a5f58fe01a | b67348ae846852244704ce0adaac9dd562f9c36f | keuller/tutorial-goapi | /internal/business/TaskService.go | Go | go | 1,614 | no_license | package business
import (
"fmt"
"log"
m "github.com/keuller/simple-api/internal/models"
)
type TaskService struct {
repository TaskRepository
}
// constructor function
func NewTaskService(repo TaskRepository) TaskService {
return TaskService{repo}
}
func (s TaskService) CreateNewTask(data m.AddTask) error {
... |
a0d69b31ebc4b1530e9a1e686a74bc6a657edb6b | bb038fed3a69cc02f0e475c44bacac8db5dfabfa | tepletonteam/tepleton | /cmd/basecoin/commands/counter.go | Go | go | 1,069 | no_license | package commands
import (
"fmt"
"github.com/tepleton/basecoin/plugins/counter"
"github.com/tepleton/basecoin/types"
wire "github.com/tepleton/go-wire"
"github.com/urfave/cli"
)
var (
CounterTxCmd = cli.Command{
Name: "counter",
Usage: "Craft a transaction to the counter plugin",
Action: func(c *cli.Cont... |
46451b29660661d626d1c7dc3d305811a03a884a | 96425f9e88a8aa3a603a08274fe878a108da52c8 | mikechapman/restic | /src/restic/repository/master_index.go | Go | go | 5,639 | permissive | package repository
import (
"sync"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"
"restic/pack"
)
// MasterIndex is a collection of indexes and IDs of chunks that are in the process of being saved.
type MasterIndex struct {
idx []*Index
idxMutex sync.RWMutex
}
// NewMasterIndex creates a new m... |
d592fa5edc6211666881b2d2d55228ad7d7c97df | ae9fa064a20eb1a0d9e20505296b6aee201984bc | ak68-hub/evcc | /charger/nrgble.go | Go | go | 360 | permissive | // +build !linux
package charger
import (
"github.com/andig/evcc/api"
"github.com/andig/evcc/util"
)
// NewNRGKickBLEFromConfig creates a NRGKickBLE charger from generic config
func NewNRGKickBLEFromConfig(log *util.Logger, other map[string]interface{}) api.Charger {
log.FATAL.Fatal("config: NRGKick bluetooth is ... |
7c8504db7e643f6b415ae45c288de6519746de89 | d0e4bc82a6e37a96acbb242ddd1688891ff041aa | tsingson/gonum | /blas/blas64/blas64.go | Go | go | 15,193 | permissive | // Copyright ©2015 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package blas64
import (
"github.com/tsingson/gonum/blas"
"github.com/tsingson/gonum/blas/gonum"
)
var blas64 blas.Float64 = gonum.Implementation{}
// U... |
cd8e679cd0d7fdac5999a8055a5930d515e92b2a | c24001ff96fe8801429c1273c383ab62589e818d | lvleiice/Better-PITR | /tests/basic/generate_data.go | Go | go | 1,170 | no_license | package main
import (
"flag"
"os"
_ "github.com/go-sql-driver/mysql"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tidb-binlog/tests/dailytest"
"github.com/pingcap/tidb-binlog/tests/util"
)
func main() {
cfg := util.NewConfig()
err := cfg.Parse(os.Args[1:])
switch errors.Cause(er... |
cadf47c21ed8b9bfe772bc84c0c36ff1bcfd5a2a | 3a2a7c58885ae19add1962d929e24708f15901a5 | Hashfyre/sample-go-app | /pkg/database/postgres/config.go | Go | go | 456 | no_license | package postgres
import (
"time"
)
type Config struct {
Postgres Postgres
GORM GORM
}
// Postgres represents database connection parameters
type Postgres struct {
Host string
Port int
User string
Password string
DB string
}
// GORM represents config needed for database connection param... |
cead260d1e5ae7087f34491ae52784be4d4f5918 | 3f1bbdb7eb430c84e4df4e0f6c97c69e92b76020 | Tomasz-Smelcerz-SAP/kyma | /components/application-operator/pkg/controller/reconciler.go | Go | go | 5,843 | permissive | package controller
import (
"context"
reReleases "github.com/kyma-project/kyma/components/application-operator/pkg/kymahelm/remoteenvironemnts"
"github.com/kyma-project/kyma/components/remote-environment-broker/pkg/apis/applicationconnector/v1alpha1"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
k8sE... |
4a52d939db25ff29d883bf35e82c6a03632c75cb | eb46b3d72cc9fc5acc95f93b2879731ae0d53e78 | harryge00/istio | /tests/integration/security/sds_ingress/ingress_test.go | Go | go | 21,482 | permissive | // +build integ
// Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... |
d064485b3ef67aeed229ee4cc0d45ed68897c28a | 550d40ed296f8d241d5b7f06154a4a6290d70a81 | PrayagS/vitess | /go/vt/vtgate/executor_framework_test.go | Go | go | 17,574 | permissive | /*
Copyright 2019 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
644ae4f55d6d890e70a8633a6c149edbb68cddb7 | fd724cad371ac3130f114833e524ac759552e397 | knative/pkg | /injection/clients/namespacedkube/informers/core/v1/configmap/configmap.go | Go | go | 1,488 | permissive | /*
Copyright 2022 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
5edca542424034fd816021411de6cffd3823aaf3 | c5ef43bd108a8fec3febe23d0229bf6ca334efec | djbarber/ipfs-hack | /path/path.go | Go | go | 2,266 | permissive | package path
import (
"errors"
"path"
"strings"
key "github.com/djbarber/ipfs-hack/blocks/key"
b58 "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-base58"
mh "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multihash"
)
// ErrBadPath is returned when a given ... |
8221457387d585e4dc2ff76b1f7d186da1285169 | d1e6edfe60382e09b6810874d723285c1cfab3bc | allinbits/cosmos-sdk-semver | /x/staking/module.go | Go | go | 9,665 | permissive | package staking
import (
"context"
"encoding/json"
"fmt"
"sort"
abci "github.com/cometbft/cometbft/abci/types"
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
modulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
"cosmossdk.io/core/appmodule"
"cos... |
c3968a81523930fb88bb69d3134296d80e475b2e | ffb0c5ba96b6e866d620da57593d9e03c9f5cd2a | mosessky/twilio-go | /cmd/report-data-usage-server/main.go | Go | go | 6,420 | permissive | // Binary report-data-usage-server sends info to your SIM about how much data
// has been used.
//
// The server is primarily designed to respond to incoming webhooks from Twilio.
// Make a POST request to the server and specify a Command parameter and
// a "SimSid" parameter. The only supported Command is "Usage". The... |
058d4efeedabe7f583bd1c4b829442a6bf9ede13 | c9ffdfd7a225d222e88819c60fef076273924ef9 | adammhaile/image-registry | /pkg/dockerregistry/server/pullthroughblobstore_test.go | Go | go | 26,835 | permissive | package server
import (
"bytes"
"crypto/sha256"
"fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"strconv"
"testing"
"time"
"github.com/docker/distribution"
"github.com/docker/distribution/context"
"github.com/docker/distribution/digest"
"github.com/docker/distribution/manifest/schema1"
_ "github.co... |
63c01cc33ef6e0075266e42e9a0264dea3db55cf | b5ef592e37392d98f54b430c7992b3a55f36d857 | apache/camel-k | /pkg/util/camel/camel_util.go | Go | go | 3,286 | permissive | /*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this fi... |
b93a25566119e5d5c3658ae02517289686ac4737 | e73c49e080f3a5d07991f62f7bdb24378f97305b | bradylove/rep | /evacuation/cleanup.go | Go | go | 4,262 | permissive | package evacuation
import (
"errors"
"os"
"time"
"code.cloudfoundry.org/bbs"
"code.cloudfoundry.org/bbs/models"
"code.cloudfoundry.org/clock"
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/go-loggregator/loggregator_v2"
)
const (
ExitTimeout = 15 * time.Second
)
var ... |
18b345e99d149d3920c214c17d815ab931a587fb | 81514521d7fbaeaf313de5bc2ed9bdd58bf9c251 | itsbalamurali/sphoorthy-iot | /vendor/github.com/kataras/iris/template.go | Go | go | 9,758 | permissive | package iris
import (
"io"
"path/filepath"
"github.com/iris-contrib/errors"
"github.com/kataras/iris/utils"
)
var (
builtinFuncs = [...]string{"url", "urlpath"}
// DefaultTemplateDirectory the default directory if empty setted
DefaultTemplateDirectory = "." + utils.PathSeparator + "templates"
)
const (
/... |
eb7e82b7ea595bf9a0de94a09a12b0d3a2cb24d6 | 298a3ae724b1a6b41a1032ebf2346da6d8a0abc5 | claudioed/pipeline-converters | /cmd/backstage/api.go | Go | go | 674 | permissive | package backstage
type API struct {
ApiVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata Metadata `yaml:"metadata" json:"metadata"`
Spec Spec `yaml:"spec" json:"spec"`
}
// Metadata
type Metadata struct {
Name string `yaml:"name" json... |
17566e4b6d564fef0a7fee85408dc52ef2a831db | 1ef26e877e9d692a402d5a22030fab85fa789cf1 | kucfire/go-leetcode | /leetcode191/191_test.go | Go | go | 1,238 | no_license | package leetcode191
import (
"strconv"
"testing"
)
func TestHammingWeight2(t *testing.T) {
example1, _ := strconv.ParseUint("00000000000000000000000000001011", 2, 32)
example2, _ := strconv.ParseUint("00000000000000000000000010000000", 2, 32)
example3, _ := strconv.ParseUint("11111111111111111111111111111101", 2... |
88b49c6ca94630b3a27d9b3c84ba7398748982a5 | 4c1b98003cd737c35e6ae857e98ab74e97d1edeb | WildeGeist/venus | /pkg/beacon/drand.go | Go | go | 4,645 | permissive | package beacon
import (
"bytes"
"context"
"sync"
"time"
dchain "github.com/drand/drand/chain"
dclient "github.com/drand/drand/client"
hclient "github.com/drand/drand/client/http"
dlog "github.com/drand/drand/log"
"github.com/drand/kyber"
kzap "github.com/go-kit/kit/log/zap"
"go.uber.org/zap/zapcore"
"gola... |
529de273871fe700140f1e6148161d964378debb | 1cbb6582610df109b87d523fe2ad47e08824d18f | boyter/gitea | /modules/json/json.go | Go | go | 4,476 | permissive | // Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"bytes"
"encoding/binary"
"encoding/json"
"io"
jsoniter "github.com/json-iterator/go"
)
// Encoder represents an encoder for js... |
c5c6e3da7d8bd9967a0c6544fbad299b443bea82 | f9fbfdd3414952c4bb385c68fe017dde25254f25 | timburks/google-api-go-client | /policysimulator/v1beta1/policysimulator-gen.go | Go | go | 148,058 | permissive | // Copyright 2021 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package policysimulator provides access to the Policy Simulator API.
//
// For product documentation, see: https://cloud.google.com/iam/docs/sim... |
2ac99da0c8c14d002a3c5cdbc34bc3fbd060bde9 | b0a79bf7165cb0d5cb8ad8e3a67bea8dcc4ba41a | 2733284198/git-go-mac01 | /gorm/start2.go | Go | go | 816 | no_license | package main
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
type Product struct {
Code string
Price uint
}
/*type User struct {
id int `gorm:"primary_key"`
name string
age uint
}*/
func main() {
db, err := gorm.Open("sqlite3", "test.db")
if err != nil {
panic("failed to... |
8648288704a1d08c09556595765d984522a46bb4 | 0c09a8bd457e37a8fa76d441511af6542f91e41a | WonSik36/learningGo | /src/baekjoon/BOJ9093.go | Go | go | 1,304 | no_license | /*
baekjoon online judge
problem number 9093
https://www.acmicpc.net/problem/9093
*/
package main
import (
"bufio"
"os"
"strconv"
"strings"
)
func main() {
r := bufio.NewReader(os.Stdin)
w := bufio.NewWriter(os.Stdout)
var sb strings.Builder
N := getInt(r)
for i := 0; i < N; i++ {
sb.Reset()
strTkn ... |
7f8040a1fc4714a1d631658e5d19c5b87069acec | 5ea9315653b477d0186ef98de28c9525d0c8adbd | refaqtor/goal | /tools/generate/handlers/testdata/controllers/init.go | Go | go | 1,322 | permissive | package controllers
import (
h "net/http"
"testing"
"github.com/goaltools/goal/tools/generate/handlers/testdata/controllers/subpackage"
"github.com/naoina/denco"
)
// Controller is a struct that should be embedded into every controller
// of your app to make methods provided by middleware controllers available.... |
3492001fa8f59867c020917c282ba293bc94b7ab | bf5ea609b351d6d3b9efeaf4b95c2dddf29580f7 | kubevirt-bot/containerized-data-importer | /pkg/controller/clone-controller_test.go | Go | go | 7,784 | permissive | package controller
import (
"crypto/rand"
"crypto/rsa"
"sync"
"testing"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
)
type CloneFixture struct {
ControllerFixture
}
var (
apiServerKey *rsa.PrivateKey
apiServ... |
9e016894b09d1034d6fd3e142dee632b79cf3379 | 5d5d4b4f8d4f7293b72067a931f1f88a76c8ae3d | ishtiaq79/terraform-provider-example | /main.go | Go | go | 361 | no_license | package main
import (
"github.com/hashicorp/terraform-plugin-sdk/plugin"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/ishtiaq79/terraform-provider-example/myplugin"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: func() terraform.ResourceProvider {
return myplugin.Provider(... |
d0d00cc545156908a44ec156326980331e1d7df0 | 4b546b35b0bda6a9b1d4ba66f384eb4a994adf96 | cludden/confd-template | /backend/ssm/backend.go | Go | go | 1,924 | permissive | package ssm
import (
"confd-template/template"
"confd-template/validation"
"context"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/aws/aws-sdk-go/service/ssm/ssmiface"
"github.com/sirupsen/logrus"
)
// Backend provides access to a KV store backed by SSM
type Backend struc... |
81fc9071ee2b65351d53ed287093151b113c7bc9 | c7335d6e586d32f415334ded4a606a4026996aae | gzltommy/micro | /service/debug/log/handler/handler.go | Go | go | 1,041 | permissive | package handler
import (
"context"
"sync"
"github.com/micro/go-micro/v2/debug/log"
"github.com/micro/go-micro/v2/errors"
pb "github.com/gzl-tommy/micro/v2/service/debug/log/proto"
)
type Log struct {
// per service log
sync.RWMutex
Logs map[string]log.Log
// Ability to create new logger
New func(string) l... |
c92ea0ae86b97ac170cf217c4e6c61bc5f5e706e | ef5711c00e80d1c6962016ade6791f3f6acbfcf1 | DowneyZss/coredns | /plugin/azure/setup.go | Go | go | 3,558 | permissive | package azure
import (
"context"
"strings"
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/fall"
clog "github.com/coredns/coredns/plugin/pkg/log"
azuredns "github.com/Azure/azure-sdk-for-go/profiles/latest/dns/mgmt/dns"
azurerest "github.... |
2151544aeff0c4aca74466f1608fb5c372b14629 | edb86eaebcc96370b6469db896b98ad6996b7d57 | bashims/helm | /pkg/repo/chartrepo.go | Go | go | 9,004 | permissive | /*
Copyright The Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
2bbb4c25a364d3dbcc50130bc1048bacae8dbd10 | 6165d36aaee52ed0f99ade99a499f019f556207f | arnab-api/Online-Courses-Certificates-and-Exercise-Files- | /Exercise Files/Ex_Files_Go_EssT/Exercise Files/Ch02/02_12/maps.go | Go | go | 836 | no_license | // Go's map data structure
package main
import (
"fmt"
)
func main() {
stocks := map[string]float64{
"AMZN": 1699.8,
"GOOG": 1129.19,
"MSFT": 98.61, // Must have trailing comma in multi line
}
// Number of items
fmt.Println(len(stocks))
// Get a value
fmt.Println(stocks["MSFT"])
// Get zero value if ... |
9e1ddf933a07239454b7934d2845e0b1f8462743 | b1333e96d06d60b97fefb1afe04d30fe2ad7ddaa | phial3/fabric-2.1-gm | /bccsp/sw/hash.go | Go | go | 929 | permissive | /*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
1f435311d8cadb2b541c5ef78fe4a28604893821 | 51791fae92457faf6ce35868329e8f7508825d69 | gmlewis/go-threejs | /three/video_texture.go | Go | go | 1,525 | permissive | // Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
d6310376c888638b60e04f8d298b6b7d89087d20 | 2dac8e314324bbea3f13a8b9f86045e4a34fbecd | Vorringer/oci-go-sdk | /dns/change_tsig_key_compartment_request_response.go | Go | go | 5,083 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
04af0d6d78f61825465d2a353385cdcd049d4297 | 097b58704de31381d8dd4c76cc6f5c5c6cbba9c7 | Dean-Coakley/tailscale | /net/netcheck/netcheck.go | Go | go | 32,357 | permissive | // Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package netcheck checks the network conditions from the current host.
package netcheck
import (
"bufio"
"context"
"crypto/tls"
"errors"
"fm... |
4fe3bf01117fb3b3853dfc9f5f8ec11ab6a43238 | 8321da8e0390358f65f1206117d3119c87c44a6e | camilosampedro/logrus-stackdriver-formatter | /example/example.go | Go | go | 938 | permissive | package stackdriver_example
import (
"os"
"strconv"
stackdriver "github.com/TV4/logrus-stackdriver-formatter"
"github.com/sirupsen/logrus"
)
func ExampleLogError() {
logger := logrus.New()
logger.Out = os.Stdout
logger.Formatter = stackdriver.NewFormatter(
stackdriver.WithService("test-service"),
stackdri... |
48f262242708bc24f93ec646ef4b186ddbd85866 | 56a18655d620f5044abfd8d92fcb7e3cad14a552 | ailabstw/go-pttai-core | /key/key.go | Go | go | 800 | no_license | package key
import (
"crypto/ecdsa"
"crypto/rand"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
func GenerateKey() (*ecdsa.PrivateKey, error) {
var key *ecdsa.PrivateKey
var err error
for i := 0; i < NGenerateKey; i++ {
key, err = generateKeyCore()
if err != nil {
... |
ffc58cb19ec3678f13e8f0cce403958b8d4234fa | 63c8ae5c85221ded033a12451ea3a645132f5008 | toggl/steps-xamarin-archive | /vendor/github.com/toggl/go-xamarin/analyzers/project/project.go | Go | go | 4,045 | permissive | package project
import (
"fmt"
"path/filepath"
"strings"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/toggl/go-xamarin/constants"
"github.com/toggl/go-xamarin/utility"
)
// ConfigurationPlatformModel ...
type ConfigurationPlatformModel struct {
Configuration stri... |
6e048b87dcb912c2387e371ecc8ebf59fdec5ae1 | 7a3511d58328376d26e26a2cf13422f2ac6fd789 | vicever/go | /src/encoding/xml/xml_test.go | Go | go | 22,577 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xml
import (
"bytes"
"fmt"
"io"
"reflect"
"strings"
"testing"
"unicode/utf8"
)
const testInput = `
<?xml version="1.0" encoding="UTF-8"?>
<!DOC... |
0c2f3af1a74fda2eb16c367eb76be6e4a07bdf93 | 70ac05e3ea65142f633d74a682642a0ff5c4e8a1 | git-town/git-town | /vendor/github.com/xanzy/go-gitlab/repository_submodules.go | Go | go | 3,148 | permissive | //
// Copyright 2021, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or a... |
6bd645c904d74867036c1433bd6ca4eb5a04726f | 2bdd09cea7a3dc09c1085914b8096b2a60cf1534 | jiangshao666/Fortc | /fnet/request.go | Go | go | 467 | no_license | package fnet
import(
"github.com/jiangshao666/Fortc/fiface"
)
type Request struct {
conn fiface.IConnection
msg fiface.IMessage
}
func NewRequest(conn fiface.IConnection, msg fiface.IMessage) *Request {
return &Request{
conn: conn,
msg: msg,
}
}
func (r *Request)GetConnection() fiface.IConnection {
retur... |
c7f5566b0104858ceacf1e55539ae4ccdb596569 | 3f48e6f1f834c74cee028d7ca074455e5bc429f0 | ashirvadgupta/loki | /pkg/ingester/transfer_test.go | Go | go | 5,315 | permissive | package ingester
import (
"fmt"
"io"
"io/ioutil"
"sort"
"testing"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/health/grpc_health_v1"
"github.com/cortexproject/cortex/pkg/ring"
"github.com/cortexproject/cortex/pkg/ring/kv"
"github.com/cortexproject/cortex/pkg/ring/kv/codec"
"github.com/stretch... |
fc7b79fa14ef06bbc904aff2a1614b0b3f311e2b | 31d0146c790d76501af8b26b317f2e8c27477b74 | keonjeo/xuperunion | /test/util/model.go | Go | go | 3,493 | permissive | // package util 包含了一些测试用的便捷工具
package util
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/golang/protobuf/proto"
log "github.com/xuperchain/log15"
crypto_client "github.com/xuperchain/xuperunion/crypto/client"
"github.com/xuperchain/xuperunion/kv/kvdb"
"github.com/xuperchain/xuperunion/ledg... |
6e029926b2949ecfda44443293beb4270fc6f509 | c910c0caada6e0ff011928277678439799c984aa | another2one/learn-go | /dataStructure/stack/array.go | Go | go | 890 | no_license | package main
import (
"errors"
"fmt"
)
type ArrayStack struct {
maxSize, head int
data []int
}
func NewArrayStack(maxSize int) *ArrayStack {
return &ArrayStack{
maxSize: maxSize,
head: -1,
data: make([]int, maxSize),
}
}
var (
ErrorStackEmpty = errors.New("stack empty")
ErrorStackFull ... |
aeb9234128e307fd430aa62162fc04306bdfe73c | ef2fd4043bb94d29feeeb276b1b3856452ddc6da | hfuss/dns-operator | /pkg/controller/add_multivaluednsrecord.go | Go | go | 282 | permissive | package controller
import (
"github.com/hfuss/dns-operator/pkg/controller/multivaluednsrecord"
)
func init() {
// AddToManagerFuncs is a list of functions to create controllers and add them to a manager.
AddToManagerFuncs = append(AddToManagerFuncs, multivaluednsrecord.Add)
}
|
6894bec6b483e8187b346623ae33fc01cbeb67a3 | e797269da708600692101ff81228aa5788aaf1da | pks-os/kuma | /app/kumactl/cmd/install/install_crds_test.go | Go | go | 1,646 | permissive | package install_test
import (
"bytes"
"io/ioutil"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/kumahq/kuma/app/kumactl/cmd"
"github.com/kumahq/kuma/app/kumactl/pkg/install/data"
)
var _ = Describe("kumactl install crds", func()... |
bb7da090ccff1e6114a34f34b92dcd3144ee479a | 7e6077a3e6ca7da9a9b0d6266ac45e8c7f550780 | sunw31/boilerplate | /application/run/run.go | Go | go | 1,606 | permissive | package run
import (
"context"
k "github.com/michilu/boilerplate/application/config"
"github.com/michilu/boilerplate/service/errs"
"github.com/michilu/boilerplate/service/profile"
"github.com/michilu/boilerplate/service/slog"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.opencensus.io/trace"
"github... |
ddc3aa4dbbc3c0068e25ab7e64ab80a0eb0388b7 | 12ee01ae29589639a61331d3165b051e4657fb0a | boynton/hue | /hue.go | Go | go | 11,278 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"sort"
"strconv"
"strings"
)
type Hue struct {
URL string `json:"-"`
Lights map[string]Light `json:"lights,omitempty"`
Groups map[string]Group `json:"groups,omitempty"`
Scenes ... |
373196d7e0ddd5dae3737856cf91e08d48dd2143 | afa438b14336171af29461b6263927a49c48aa27 | alessio-perugini/lazyfit | /schedule.go | Go | go | 1,821 | no_license | package lazyfit
import (
"encoding/json"
"fmt"
)
func UnmarshalImpegni(data []byte) (Schedules, error) {
var r Schedules
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Schedules) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type Schedules struct {
Data []Schedule `json:"data"`
}
type Sched... |
e285c7937d8be0d0cf8367a48aaca68a30152675 | 0b58911e210d5ec098f86bfbe57ce74fccf9dcbb | harinigunabalan/app-autoscaler | /src/autoscaler/db/sqldb/policy_sqldb_test.go | Go | go | 5,451 | permissive | package sqldb_test
import (
. "autoscaler/db/sqldb"
"autoscaler/models"
"code.cloudfoundry.org/lager"
"github.com/lib/pq"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"encoding/json"
"os"
)
var _ = Describe("PolicySQLDB", func() {
var (
pdb *PolicySQLDB
url string
logger ... |
ceaf8a77c550f4eb5a23954297edde1d7e92bacc | f4c59f6d7f673aac262e8b42088016b8e9eb4226 | kentik/kentik-deps | /pkg/netflow/ipfix/packet.go | Go | go | 20,714 | permissive | package ipfix
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"strings"
"time"
"github.com/kentik/kentik-deps/pkg/netflow/read"
"github.com/kentik/kentik-deps/pkg/netflow/session"
)
// IPFIX
const (
// Version word in the Message Header
Version uint16 = 0x000a
// EnterpriseBit used in the Field Specifier
... |
c712edfdd7cf099529343fafa7901bed1bf80c4e | 00fd72a66bc111ea89a8475ac32dc7efd9faf0fe | osbuild/osbuild-composer | /vendor/github.com/oracle/oci-go-sdk/v54/core/boot_volume.go | Go | go | 9,631 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
392079dc345e2f86797eac98933df46c62a97286 | 78100e448c132e0024eed2542422444bdad25551 | comzyh/gvisor | /pkg/sentry/fs/file.go | Go | go | 18,042 | permissive | // Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
b7d9760104fcda4ab42e415cf50f5620d5ea155e | dfbedc31b103fdef56273c114f64c2d008a367d5 | nexthack/ems | /handlers.go | Go | go | 1,989 | no_license | // Package main spwans a server daemon and listens for analyse requests.
package main
import (
"encoding/json"
"net/http"
"github.com/crackerplace/ems/models"
"github.com/crackerplace/ems/store"
"github.com/gorilla/mux"
)
func createDepartmentHandler(repo *store.Repo) func(w http.ResponseWriter, r *http.Request... |
4a2eec39cd6334709963249d8b99135535e94746 | 6eb2b4f7e80707e97783accbf504b3e379575eb6 | jasonody/system-programming-with-go | /05_streams/runes/runes.go | Go | go | 259 | permissive | // go run runes.go
package main
import "fmt"
func main() {
const a = `⌘`
fmt.Printf("plain string: %s\n", a)
fmt.Printf("quoted string: %q", a)
fmt.Print("\nhex bytes: ")
for i := 0; i < len(a); i++ {
fmt.Printf("%x ", a[i])
}
fmt.Println()
}
|
dedc7b1c4002e7d5b4fb5482cffba45ec07ff0cb | f58201ff8b2934b664ed5592ed5da132a74752f2 | pipizhang/transcode-orchestrator | /provider/hybrik/job_status_mapping.go | Go | go | 2,734 | permissive | package hybrik
import (
"fmt"
"log"
"path"
"regexp"
"strings"
"github.com/cbsinteractive/hybrik-sdk-go"
"github.com/cbsinteractive/transcode-orchestrator/provider"
)
type taskWithOutputMatcher struct {
kind string
uidRegex *regexp.Regexp
}
var tasksWithOutputsMatchers []taskWithOutputMatcher
func init... |
96deec7c0cb4d8b1cc3ebc8af729187246b6dd95 | cf34a752afe67883d4f640aed7335836ffcbbde6 | KubeITerator/KubeIT | /s3handler/s3handler.go | Go | go | 11,058 | permissive | package s3handler
import (
"bytes"
"crypto/rand"
"errors"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
log "github.com/sirupsen/logrus"
"net/http"
... |
28020018980da9dfa15370a2fca2688be627cc2b | 818bbae69eb15808053eecd7850ef581d9379631 | whoami-shubham/Go | /go_syntax/02/Variables.go | Go | go | 368 | no_license | package main
func main() {
var a int // default value for a variable is zero
var b string = "string"
var c = 4.0 // you may not specify type
d := true // shorter way to initialize variable
const pi = 3.14 // constants
println(a)
pri... |
229d84f90e2deef2b3715db84d7e36859f195730 | f8c67ac91da399453e91f332bb97e73ae8449894 | vinhphu101195/todolist-grpc | /server/main.go | Go | go | 3,016 | no_license | package main
import (
"context"
"net"
"todo-grpc/models"
"todo-grpc/proto"
"github.com/jinzhu/gorm"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
//"google.golang.org/grpc/reflection"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
type server struct {
db *gorm.DB
}
... |
b18b38adc05cd58b87b66b7b9c572e963fa2cbd8 | 96fcdfeb1fbfdffcfe07406d123e33f36f134551 | kpn/pion | /vendor/github.com/minio/minio/pkg/event/target/nats.go | Go | go | 4,154 | permissive | /*
* Minio Cloud Storage, (C) 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
43d286ec4232799e587884911b44666d5ab6a55e | f9ea042a44a6cdbdbcb8522d312dd08bcc5316c9 | zmoon111/infranetes | /cmd/tests/bulk/bulkclient.go | Go | go | 838 | no_license | package main
import (
"fmt"
"io/ioutil"
"os"
"golang.org/x/net/context"
"google.golang.org/grpc"
"github.com/apporbit/infranetes/cmd/tests/bulk/api"
)
func main() {
conn, err := grpc.Dial("127.0.0.1:4567", grpc.WithInsecure())
if err != nil {
fmt.Printf("failed to dial: %v\n", err)
os.Exit(1)
}
client... |
08f580d3a415f3b5deb8ebbb33c310b7ffa3f540 | e7b6ccc7005cb4f490fda81dc84183e9c4c60ae0 | idoshveki/magma | /symphony/graph/ent/checklistitemdefinition_update.go | Go | go | 19,322 | permissive | // Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated (@generated) by entc, DO NOT EDIT.
package ent
import (
"context"
"fmt"
"github.com/facebookincubator/ent/dialect/sql"
"github.com... |
362a36a0711e8d4834b4dfd59132c75e8ba45d37 | 1bc3a0b323aba5522108f4148c3bac8db4bef83b | kleopatra999/compute-image-tools | /daisy/workflow/workflow_test.go | Go | go | 15,460 | permissive | // Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... |
d9b75b08d2494be49abb705370cf914fcb90758a | cba93770efcaa86f5986122e4335baca577d5e88 | lizrice/virtual-kubelet | /vendor/github.com/vmware/vic/lib/apiservers/portlayer/models/image_join_response.go | Go | go | 814 | permissive | package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
)
// ImageJoinResponse image join response
// swagger:model ImageJoinResponse
type Image... |
965d787288f8b995a88f7f811628f202feb21328 | c1943623140c03eda73e87dda44233d202c8c4db | y573724537/leetcode | /binary_search/0278.First Bad Version/solution.go | Go | go | 514 | no_license | package main
/**
* Forward declaration of isBadVersion API.
* @param version your guess about first bad version
* @return true if current version is bad
* false if current version is good
* func isBadVersion(version int) bool;
*/
func firstBadVersion(n int) int {
low, high := 1, n
fo... |
4e6ca7f7840f2ffc6da4d8d892a5d9e558e62688 | 4cd7f0d85a5de53a2a9f90e286abb0a25b65fe7a | UniverseXYZ/XYZ-Backend-copy | /notifications/worker.go | Go | go | 2,052 | permissive | package notifications
import (
"context"
"database/sql"
"time"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
var log = logrus.WithField("module", "notifs")
type Worker struct {
db *sql.DB
}
func (w *Worker) Run(ctx context.Context) {
// poll for new jobs
go func() {
for {
select {
case <-t... |
334cd40307f62db14bd1de0a6ce6bfc88774fcac | ea54fa5f840c35881d1db80a35986d38d2163606 | soloicesky/Amex | /sale.go | Go | go | 2,380 | no_license | package amex
import (
"encoding/hex"
"fmt"
"github.com/zhulingbiezhi/sdkOld/TLV"
)
type SaleTransaction struct {
entryMap map[EntryMode][]uint8
BaseElement
messageTypeId string
processingCode string
}
func NewSale(trans *TransactionData, config *Config) (*SaleTransaction, error) {
fieldMap := map[EntryMode... |
e8cae6d4a8ddaf22c5f2b86ef89f44b9074557a9 | f4567d2dd8cd3a3a41e9d5502cdbaf272dcee238 | minux/guardian | /crypto/sha256d/sha256d_test.go | Go | go | 3,012 | no_license | package sha256d
import (
"bytes"
"encoding/hex"
"testing"
)
func TestNewSHA256d(t *testing.T) {
in, err := hex.DecodeString("00010966776006953D5567439E5E39F86A0D273BEE")
if err != nil {
panic(err)
}
out, err := hex.DecodeString("D61967F63C7DD183914A4AE452C9F6AD5D462CE3D277798075B107615C1A8A30")
if err != ... |
bbde12765e249c299070da49404c2e2c64309648 | 50f52a5f9688efdefac681c409097c80eac9f27f | dolthub/dolt | /go/libraries/doltcore/dbfactory/oss.go | Go | go | 6,433 | permissive | // Copyright 2019 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
34cbc423d75831b661bc1e5ef1d8e8eb6f42485d | 83763f8340c43b48c977983ebcbac089de2e0cf7 | mccormickmichael/adventofcode-go | /v19/internal/day9/day9.go | Go | go | 1,269 | permissive | package day9
import (
"fmt"
"github.com/mccormickmichael/adventofcode-go/v19/internal/event"
"github.com/mccormickmichael/adventofcode-go/v19/internal/input"
"github.com/mccormickmichael/adventofcode-go/v19/internal/intcode"
"io"
)
type Day9 event.Solvable
func New(path string, output io.Writer) event.Day {
re... |
5c4ac2b54a11c12348ce4bad5b6241bbf3562c94 | 492dcdbdcc60859b55c6e7827ae60f3eea70ebdc | skyserpent/ladon | /policy.go | Go | go | 3,880 | permissive | package ladon
import (
"encoding/json"
"github.com/pkg/errors"
)
// Policies is an array of policies.
type Policies []Policy
// Policy represent a policy model.
type Policy interface {
// GetID returns the policies id.
GetID() string
// GetDescription returns the policies description.
GetDescription() string... |
e4e02a7000a1d45a803b2a3b2c47fadfc1fb0116 | d20f162e875026c5a8f2e27825417657272d1b36 | s-urbaniak/rec | /webapp/server.go | Go | go | 2,148 | no_license | package webapp
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/websocket"
"github.com/s-urbaniak/rec/msg"
"github.com/s-urbaniak/rec/recorder"
)
var upgrader = websocket.Upgrader{}
func wsHandler(res http.ResponseWriter, req *http.Request) error {
c, err := upgrader.Upgrade(res, req, nil)
if err != nil ... |
7f8b2aeb307124bbd9ac12efdc72f96d41e04c76 | 0ac4ae2c5cda033d6f472be07cd5b9ab979ae998 | Nikhil-Ladha/meshery | /server/models/meshery_filter_persister.go | Go | go | 4,846 | permissive | package models
import (
"encoding/json"
"fmt"
"strings"
"github.com/gofrs/uuid"
"github.com/layer5io/meshkit/database"
)
// MesheryFilterPersister is the persister for persisting
// wasm filters on the database
type MesheryFilterPersister struct {
DB *database.Handler
}
// MesheryFilterPage represents a page ... |
1cf8da44754fbab9544b86d0b27bc8432c639c73 | 275ef7473d0ebe771b3f1a454f6831cd008a0c38 | dkbalachandar/simple-hello-go | /hello.go | Go | go | 542 | no_license | package main
import (
"fmt"
"net/http"
)
func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello %s", r.URL.Path[1:])
}
func queryHandler(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
if name == "" {
fmt.Fprin... |
c4a6c977d0fa1968b913c98e3f67bba46e058b82 | 631dc83709824712ae6f4202230bfe4fd3b73dbb | negz/voyager | /pkg/orchestration/admission.go | Go | go | 2,681 | permissive | package orchestration
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/atlassian/voyager"
"github.com/atlassian/voyager/pkg/admission"
orch_v1 "github.com/atlassian/voyager/pkg/apis/orchestration/v1"
"github.com/go-chi/chi"
"github.com/pkg/errors"
"go.uber.org/zap"
admissionv1beta... |
1450cca3ade2b4e6185eb20f94bc6e68cafd450b | a2e9bccc0866dc59b8ff1d61bdfc1491de09d57f | scmilee/gosnake | /game.go | Go | go | 7,242 | permissive | package main
import (
"flag"
"fmt"
"io/ioutil"
"github.com/ahmetalpbalkan/go-cursor"
"github.com/nsf/termbox-go"
"math/rand"
"strconv"
"strings"
"time"
)
//make this variable
var table_height int = 0
var table_width int = 0
var FPS int = 5
var body_gain int = 3
var fruit_spawn_timer = 4000
const standard_w... |
330cd64455aa3c4377dde803bef6175096fc7dd2 | 22556f25c2e917f19417a68f47b195a7d3631c15 | xiangrumei/nbp | /vendor/github.com/kubernetes-incubator/service-catalog/vendor/k8s.io/api/batch/v1beta1/types.go | Go | go | 6,478 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
df84e7d2b1ea9d93a9294ec2a6e87dc175b5b155 | 5df195e5502d632a81efbb7048924d23a061c086 | isabella232/locales-2 | /en_BW/en_BW_test.go | Go | go | 18,760 | permissive | package en_BW
import (
"testing"
"time"
"github.com/gohugoio/locales"
"github.com/gohugoio/locales/currency"
)
func TestLocale(t *testing.T) {
trans := New()
expected := "en_BW"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
}
func TestPluralsRange(t *test... |
881b5d260fadc653ce7eeacd32278122a4431b54 | ceb3ef29e65fabdd3e654c0cbe02b57e231e4306 | yanyuxuanz/gf | /net/ghttp/ghttp_server_session.go | Go | go | 8,632 | permissive | // Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package ghttp
import (
"encoding/json"
"strconv"
"st... |
8b36fa569c158407b8cf0121687668a060a837c1 | 877461d56dd6f2dd8c8115423ca203ac0ae3a859 | sunday2146/blog-1 | /control/init.go | Go | go | 3,231 | permissive | package control
import (
"blog/model"
"io"
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
"time"
"github.com/labstack/echo"
"github.com/zxysilent/util"
)
// IndexView 主页面
func IndexView(ctx echo.Context) error {
//return ctx.HTML(200, `<html><head><meta charset="UTF-8"><title>文档</title></head><body><... |
d4afc21c6ba9f33b970b6411f98cc07d025e0074 | 25c4b5469b10c651c282ee8056425f52b98a95b7 | MickMake/GoSyncDns | /cmd/cmd_dns.go | Go | go | 5,075 | no_license | package cmd
import (
"GoSyncDNS/Only"
"errors"
"fmt"
"github.com/spf13/cobra"
)
// ******************************************************************************** //
var cmdLookup = &cobra.Command{
Use: "query",
Aliases: []string{"lookup", "search"},
Short: fmt.... |
756fb589210e082a66898329ec3aaebb1b55bef6 | 2e2eccbe7bd11782f75e9c6aed5f7102dc69315e | aaam/logging-operator | /pkg/sdk/model/output/http.go | Go | go | 5,482 | permissive | // Copyright © 2020 Banzai Cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
5591439159478d77b55f3d960a07a27f63aa5a4d | 31e8b4fe88c2725437452efab03f1104fb42884b | merkeld/gocryptotrader | /exchanges/websocket/wshandler/wshandler_types.go | Go | go | 5,658 | permissive | package wshandler
import (
"sync"
"time"
"github.com/gorilla/websocket"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
"github.com/thrasher-corp/gocryptotrader/exchanges/protocol"
"github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wsorderb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.