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 |
|---|---|---|---|---|---|---|---|---|
43b722c91d3bb8d7b2c571cfc37b22316a80ea13 | c87b4ecb9bea7882f7a7a87eb22e7bf857d77ae3 | nofun97/frozen | /lazy/set_test.go | Go | go | 2,951 | permissive | package lazy
import (
"runtime"
"sort"
"sync"
"sync/atomic"
"testing"
"github.com/arr-ai/frozen"
)
type eagerLazyPair struct {
index int
eager Set
lazy Set
}
type eagerLazySlice []eagerLazyPair
func (s eagerLazySlice) Len() int {
return len(s)
}
func (s eagerLazySlice) Less(i, j int) bool {
return s[i... |
e90c26694d87a995c6b3542e9afa3dc214f13af1 | 6e213e98b771c19250cf9c0ff56b486efe8be74a | BNPrashanth/go-celeb-poc | /internal/services/payment.go | Go | go | 1,429 | no_license | package services
import (
"bytes"
"net/http"
"strconv"
middleware "github.com/go-openapi/runtime/middleware"
"github.com/BNPrashanth/go-celeb-poc/internal/logger"
"github.com/BNPrashanth/go-celeb-poc/models"
"github.com/BNPrashanth/go-celeb-poc/restapi/operations/test"
)
// PPClient struct
type PPClient stru... |
efb56660d8535c6e45967fb6e5515334631a7d28 | 51eb95a8307ee72dd016a59adb25a7847847367b | molon/atlas-contacts-app | /pkg/pb/contacts.overwrite.pb.gw.go | Go | go | 1,047 | permissive | package pb
import (
"github.com/infobloxopen/atlas-app-toolkit/gateway"
)
func init() {
forward_Profiles_Create_0 = gateway.ForwardResponseMessage
forward_Profiles_Read_0 = gateway.ForwardResponseMessage
forward_Profiles_Update_0 = gateway.ForwardResponseMessage
forward_Profiles_Delete_0 = gateway.ForwardResp... |
44deaf2f1572414cc387329801bb2d723b7bfaf9 | c0953096c113b8818c7a5ad6813ef6cb96d6f696 | lxlchl/kubesphere | /pkg/utils/esutil/esutil.go | Go | go | 1,431 | permissive | /*
Copyright 2020 KubeSphere 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... |
9e036c48c2549b0980d44ad1a7f524e56bec2fbb | d472f4bc751c680324b4732b622144fadc47551f | pavedroad-io/eventbridge | /s3/s3.go | Go | go | 2,851 | permissive | package s3
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
"github.com/google/uuid"
"github.com/minio/minio-go/v7"
)
func s3main() {
c := Customer{}
customers, err := c.LoadFromDisk("customer.yaml")
if err != nil {
log.Fatalf("fail loading customer.yaml: %v\n", err)
}
var eConf ... |
f28e42fb2cf151c98c81732feee41a9691493b1f | af43d665e5b6514c3318ae29c741c01478118035 | anweilaw/asimov | /protos/msgmempool.go | Go | go | 1,611 | permissive | // Copyright (c) 2018-2020 The asimov developers
// Copyright (c) 2013-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package protos
import (
"io"
)
// MsgMemPool implements the Message interface and represents a bitcoin mempool
// mes... |
8a187b4ddf3b19568613c0c586f3c4ccf34515be | eddfec650a7455bf4d194ca9e9fb4dd930742ebf | peernova-private/concourse-builder | /test/string.go | Go | go | 752 | no_license | package test
import (
"testing"
"github.com/pmezard/go-difflib/difflib"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func ContextDiff(expected, actual string) string {
diff := difflib.ContextDiff{
A: difflib.SplitLines(expected),
B: difflib.SplitLines(actual),
... |
8d35277de7b856be028620ba943cb226934074fa | 6a801d984b789905642b310a20ac0ab0f7de1725 | bububa/opentaobao | /model/smartstore/TmallPopupstoreActivityDeviceQueryResultDto.go | Go | go | 478 | permissive | package smartstore
// TmallPopupstoreActivityDeviceQueryResultDto 结构体
type TmallPopupstoreActivityDeviceQueryResultDto struct {
// 结果code
Code string `json:"code,omitempty" xml:"code,omitempty"`
// 错误msg
Msg string `json:"msg,omitempty" xml:"msg,omitempty"`
// 结果数据条数
Total int64 `json:"total,omitempty" xml:"tota... |
6ff29b7ce196253220621c2ca9b83650eec28b99 | 67f549d9e908fd1925b315580d196b25c0075498 | DenesCs/gomplate | /crypto/rsa_test.go | Go | go | 2,576 | permissive | package crypto
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func genPKCS1PrivKey() (*rsa.PrivateKey, string) {
rsaPriv, _ := rsa.GenerateKey(rand.Reader, 4096)
privBlock := &pem.Block{
Type: "RSA PRIVATE KEY",
Bytes: x509.Ma... |
a583c4a05cf38f7b413fa3f0ca9e85d224b96297 | 237bebac2c18fcb7b46531f8e1d15cb0d7a97ede | jeffrom/logd | /testhelper/mock_server.go | Go | go | 4,220 | permissive | package testhelper
import (
"bytes"
"errors"
"io"
"log"
"net"
"sync"
"time"
"github.com/jeffrom/logd/internal"
)
// MockServer sets expected requests and responds
type MockServer struct {
c net.Conn
b []byte
in chan func([]byte) io.WriterTo
connInC ... |
9cb7d77f78ec55557e506061d8af1ff2ea7e30f7 | 2748b93509fd4bd562ad5c965ae2ad8a3f596c53 | seshgirik/istio | /pkg/test/framework/components/istio/ingress.go | Go | go | 10,442 | permissive | // 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 law or agreed to in wri... |
4cac1bdc3c3d05d424496273070e2b05fec17bd7 | e55e655718984abe1957cf3f521c602ca9393b11 | golang/gofrontend | /libgo/go/math/big/ratconv_test.go | Go | go | 15,928 | permissive | // Copyright 2015 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 big
import (
"bytes"
"fmt"
"io"
"math"
"strconv"
"strings"
"testing"
)
var exponentTests = []struct {
s string // string to be scanned
... |
dd3c9f810be77b3ddd0748c70256244e2aad1837 | 068d911c11837556a910f70b4550118f79db5419 | shunwuyu/lesson_md | /GO/cong/main1.go | Go | go | 721 | no_license | package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
fmt.Println("Hello, world")
url := "http://www.baidu.com/"
download(url)
}
func download(urlString string) {
client := &http.Client{} //实例化 & 取下地址
req, _ := http.NewRequest("GET", urlString, nil) // _ reset
// 自定义Header
req.Header.Set("Us... |
6e21877e526340745be04a7533c76fb9dfff8a09 | 4603178afe5f94b70a66e635dbb96a4aa1e989cd | jsonn/pkgsrc | /databases/mongo-tools/patches/patch-vendor_src_github.com_spacemonkeygo_openssl_build.go | Go | go | 666 | no_license | $NetBSD: patch-vendor_src_github.com_spacemonkeygo_openssl_build.go,v 1.2 2017/05/03 16:49:54 fhajny Exp $
Simplify lib flags look up via pkg-config.
--- vendor/src/github.com/spacemonkeygo/openssl/build.go.orig 2016-12-29 22:33:41.000000000 +0000
+++ vendor/src/github.com/spacemonkeygo/openssl/build.go
@@ -16,9 +16,... |
062b9133fd5ccc7060778a7102894f3cc9f4f9e5 | 1b2bf17fdb7e83ee91f69560dc39ba70f45a75b0 | GeoNet/delta | /tools/cusp/main.go | Go | go | 3,803 | permissive | package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
)
var aliases = map[string]string{
"LPOC": "3A",
}
var gps = map[string]string{
"10417": "feruno", //# 3B-050008 @ AMBC
"331": "feruno", //# 3B-050057 @ CCCC
"306": "feruno", //# 3B-050048 @ CHHC
"10402": "garmin", //# 3B-050019 @ CSTC
"104... |
31c4b1138730200616c1ae90cc83939d24c570be | 687790b9c2f1a1485d2f7fa9c115e4d92de760c3 | greatnonso7/Hackerrank-s-Golang-30-days-of-code | /1 - Data types/solution.go | Go | go | 465 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func main() {
var _ = strconv.Itoa // Ignore this comment. You can still use the package "strconv".
var i uint64 = 4
var d float64 = 4.0
var s string = "HackerRank "
scanner := bufio.NewScanner(os.Stdin)
var i2 uint64
var d2 float64
var s2 string
... |
9ef2b37bda57eba14bd1e2196938e67bb78b6176 | 452c2af279cb3fd17f996a65e07bc836023b230b | nyaxt/otaru | /blobstore/fileblobstore_test.go | Go | go | 5,558 | permissive | package blobstore_test
import (
"io/ioutil"
"os"
"path"
"reflect"
"sort"
"testing"
"github.com/nyaxt/otaru/blobstore"
"github.com/nyaxt/otaru/flags"
tu "github.com/nyaxt/otaru/testutils"
"github.com/nyaxt/otaru/util"
)
func TestFileBlobStore_MultiPRead(t *testing.T) {
bs := tu.TestFileBlobStoreOfName("fil... |
98e4ebfa966af38c2e46ffde299fe144fed6b916 | f114841c001e11de1b02d25f8abf4b6db0543d18 | francoishill/golang-common-ddd | /Interface/Storage/DbStorage/DbStorageScannableResult.go | Go | go | 334 | permissive | package DbStorage
type DbStorageScannableResultSingleRow interface {
Columns() ([]string, error)
MapScan(dest map[string]interface{}) error
Scan(dest ...interface{}) error
StructScan(dest interface{}) error
}
type DbStorageScannableResultMultipleRows interface {
DbStorageScannableResultSingleRow
Next() bool
Cl... |
957bc65dcbcd0303f1a7c2dcaa8cef4bc1324fdc | 2d7ae81bafd6ec74f9215804a66d36ff783e30d6 | Neirpyc/goblin | /goblin_test.go | Go | go | 11,050 | permissive | package goblin
import (
"os"
"reflect"
"strings"
"testing"
"time"
)
func TestAsync(t *testing.T) {
fakeTest := testing.T{}
g := Goblin(&fakeTest)
g.Describe("Async test", func() {
g.It("Should fail when Fail is called immediately", func(done Done) {
g.Fail("Failed")
})
g.It("Should fail when Fail is... |
fab891df6ca59c1570e78919360846ba27e00ed7 | 39260495943fd747f02f62956619fcc4786ddbb5 | bradbeam/mesos-dns | /records/generator.go | Go | go | 19,147 | permissive | // Package records contains functions to generate resource records from
// mesos master states to serve through a dns server
package records
import (
"crypto/sha1"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/mesosphere/mesos-dns/errorutil"
... |
50b2a385d7cb31d7e6a4efbd80e4b3605084f750 | 792621bbef45187d3145b2894f40a5a846f17655 | benyanke/authelia | /internal/configuration/validator/identity_providers.go | Go | go | 3,122 | permissive | package validator
import (
"fmt"
"net/url"
"github.com/authelia/authelia/internal/configuration/schema"
"github.com/authelia/authelia/internal/utils"
)
// ValidateIdentityProviders validates and update IdentityProviders configuration.
func ValidateIdentityProviders(configuration *schema.IdentityProvidersConfigur... |
21ab33552254a1bbb8dbc7d16b12308f82953159 | 347f7ca6a929981479df5901f36d7251fbaef92e | licailing/learn-Go | /sha1.go | Go | go | 975 | no_license | package main
import (
"crypto/md5"
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"log"
"os"
)
func md5s(s string) string {
r := md5.Sum([]byte(s))
return hex.EncodeToString(r[:])
}
func md5f(fName string) string {
f, e := os.Open(fName)
if e != nil {
log.Fatal(e)
}
h := md5.New()
_, e = io.Copy(h, f)
if e... |
a99ec871333f8b63e7c94a170aeed23e1e3747f4 | 62fc5bb69486c191069faaa27e642f1801b56323 | lxw1844912514/gobasestudy | /write.go | Go | go | 2,717 | no_license | package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
)
//创建文件
//使用os.Create(name string)方法创建文件
//使用os.Stat(name string) 方法获取文件信息
func checkErr(err error) {
if err != nil {
panic(err)
}
}
func readFile(path string) {
data, err := ioutil.ReadFile(path)
checkErr(err)
fmt.Println("file content:", string(data)... |
573a656768e372cef0b08912616303b2b0f29884 | e1242848eb327b5b170e1f8e326e20446d0ee1f7 | GoogleCloudPlatform/golang-samples | /securitycenter/notifications/update_notification_config.go | Go | go | 2,475 | permissive | // Copyright 2020 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 ... |
d4f64cc50954a55946716c7d1a3cc8a3f191c3da | 0e4667e1a098430fa04e1dafb81a6a28af654846 | jackyalbo/cloud-credential-operator | /vendor/github.com/microsoftgraph/msgraph-sdk-go/users/item/onenote/notebooks/item/sectiongroups/section_groups_request_builder.go | Go | go | 8,959 | permissive | package sectiongroups
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653dc... |
870282767c5f5a6b7991b29c6e6cc5ac835b6c96 | d6207c059874a1c632e9402bdccd95ba54a082d4 | HunterGooD/goTypes | /binarytree/binaryTree.go | Go | go | 612 | no_license | package binarytree
import "fmt"
// Tree дерево они же узлы
type Tree struct {
Left *Tree
Value int
Right *Tree
}
// Traverse Выводит все элементы двоичного дерева
func Traverse(t *Tree) {
if t == nil {
return
}
Traverse(t.Left)
fmt.Print(t.Value, " ")
Traverse(t.Right)
}
// Insert добавить элементв дер... |
ca28170c69d2d72a0bb15afeb65952c2c0173709 | 923860eb1212365f957dcf60fabdea9afd46c080 | fredericalix/go-sdk | /ovh/types/hosting_web_database_creation_database_capabilities.go | Go | go | 599 | permissive | /*
* OVH API - EU
*
* Build your own OVH world.
*
* OpenAPI spec version: 1.0.0
* Contact: api-subscribe@ml.ovh.net
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
package types
// HostingWebDatabaseCreationDatabaseCapabilities Struct which describs quota and available for a specific typ... |
925f5fc58bdffa144ec9dae5029c942fbdf23d06 | 25cdf201667866e1aed4dca6564da44e97560660 | fabiendibot/chartmuseum | /pkg/config/vars.go | Go | go | 12,343 | 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... |
db12ab0c22fb83d7cbf9065397c1a442646320b3 | 94441859907dcb10b4882688b17eca8f76a780f3 | windeko/chainlink | /core/cmd/renderer_test.go | Go | go | 5,858 | permissive | package cmd_test
import (
"bytes"
"io/ioutil"
"regexp"
"testing"
"time"
"github.com/smartcontractkit/chainlink/core/cmd"
"github.com/smartcontractkit/chainlink/core/internal/cltest"
"github.com/smartcontractkit/chainlink/core/store/models"
"github.com/smartcontractkit/chainlink/core/store/presenters"
"githu... |
63d7078b0c7b4b5e1a3d58fbcac033a104b393ad | 5708fe7a39498aaacd8c028bec4133bd58d3a685 | iCodeIN/akita-cli | /pcap/packet_util.go | Go | go | 3,104 | permissive | package pcap
import (
"net"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
)
func CreatePacket(src, dst net.IP, srcPort, dstPort int, payload []byte) gopacket.Packet {
return CreatePacketWithSeq(src, dst, srcPort, dstPort, payload, 0)
}
func createPacketLayers(src, dst net.IP, srcPort, dstPort... |
2bc37cf902281d228f1b7df2f76a361455affb19 | 7a0df4a11ece6546e27ba4fe88a9567eecfdd455 | keybase/client | /go/kbfs/libfs/tlf_edit_history_file.go | Go | go | 740 | permissive | // Copyright 2015-2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package libfs
import (
"time"
"github.com/keybase/client/go/kbfs/data"
"github.com/keybase/client/go/kbfs/libkbfs"
"golang.org/x/net/context"
)
// GetEncoded... |
48439e312fde5a447cc2e28ad1d4afe11c1442c6 | cb4e4587806be269a2add5aceb32bd1e5abd2555 | AccelByte/accelbyte-go-sdk | /match2-sdk/pkg/match2client/backfill/accept_backfill_responses.go | Go | go | 11,237 | permissive | // Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated; DO NOT EDIT.
package backfill
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"strings"
"github.com/go-openap... |
e363653a4dbe16754b7111ad4d8e3e761f04c434 | 842a934d17c44a71704e85f87af5a05d31ffd4fc | im-kulikov/yaml | /yaml.go | Go | go | 10,197 | permissive | // Package yaml implements YAML support for the Go language.
//
// Source code and other details for the project are available at GitHub:
//
// https://github.com/go-yaml/yaml
//
package yaml
import (
"errors"
"fmt"
"reflect"
"strings"
"sync"
)
// MapSlice encodes and decodes as a YAML map.
// The order of key... |
4b3a9eb15f98ad59062de2eeb850c4334dbf2ed6 | 9cdc61aca12624b5182b0d8ab4afbd7c3345a425 | youtzz/gopher30days | /algorithm/binarysearch/074_Search-a-2D-Matrix/solution_benchmark_test.go | Go | go | 368 | no_license | package searcha2dmatrix
import "testing"
func Benchmark_searchMatrix(b *testing.B) {
args := tests[0].args
b.ResetTimer()
for i := 0; i < b.N; i++ {
searchMatrix(args.matrix, args.target)
}
}
func Benchmark_searchMatrix_best(b *testing.B) {
args := tests[0].args
b.ResetTimer()
for i := 0; i < b.N; i++ {
s... |
1e0ec1fdc1a9b00d85a2670806254b687200a960 | 54e6d9e32f0dd589b329b5cc51a3a4330b0ba0e3 | Bophin/gouser | /gouser.go | Go | go | 2,943 | no_license | package gouser
import (
"crypto/sha256"
"os"
"io"
"fmt"
"strings"
)
type userData struct {
id string
salt string
hash string
}
var pwdfile = "pwd.txt"
var command = "check"
func SetPwdFile(name string) {
pwdfile = name
}
//Tries to add user to the passwordfile. Returns false if the username
//already exis... |
8d0e2ba03a70b39f0f70d4abea5522c1d18cdfe5 | 1d92192f3438c3c2aaf7a5770f8ae9343b484963 | micro-company/go-auth | /vendor/google.golang.org/grpc/benchmark/primitives/context_test.go | Go | go | 2,686 | permissive | /*
*
* 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 applicable law or agree... |
904e4354f2294ac33b3ed505010e292042d5dac4 | 4cd97b093e97faf6d135183363e44a52e31c2ce4 | flasheryu/the-go-programming-language | /ch01/exercise_01_06.go | Go | go | 1,922 | no_license | /*
Exercise 1.6: Modify the Lissajous program to produce images in multiple
colors by adding more values to palette and then displaying them by changing
the third argument of SetColorIndex in some interesting way.
I chose some colors from http://raebear.net/comp/emacscolors.html and looked
up how to generate... |
f7df079ae6cef3870490424fe4a565780650855f | d71eebd9af30e4f6b00488bba5fc41756e2fa879 | itaiw/terraform-provider-databricks | /storage/resource_dbfs_file.go | Go | go | 5,566 | permissive | package storage
import (
"bufio"
"crypto/md5"
"encoding/base64"
"encoding/hex"
"fmt"
"io/ioutil"
"log"
"os"
"reflect"
"github.com/databrickslabs/databricks-terraform/common"
"github.com/databrickslabs/databricks-terraform/internal"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/... |
bb56afafbdfb3c7564b98e58a94ab02270884b38 | ce24e512293ff2ff7067976055b79057efdd9998 | deepch/vdk | /format/fmp4/esio/esio.go | Go | go | 3,198 | permissive | package esio
import (
"errors"
"fmt"
"github.com/deepch/vdk/utils/bits/pio"
)
type StreamDescriptor struct {
ESID uint16
DependsOn *uint16
URL *string
OCR *uint16
DecoderConfig *DecoderConfigDescriptor
SLConfig *SLConfigDescriptor
}
// Tag identifies element stream descriptor types
t... |
c89825d68bcdf718a2b4e3303949e98a74e649e3 | e82eaa5eddbb90ed3853d0172c6dd058f48ced66 | buck54321/dcrdata | /explorer/explorerroutes.go | Go | go | 65,143 | permissive | // Copyright (c) 2018-2019, The Decred developers
// Copyright (c) 2017, The dcrdata developers
// See LICENSE for details.
package explorer
import (
"database/sql"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"math"
"net/http"
"strconv"
"strings"
"time"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/... |
e372d9dec6ae06cdd8d1e3a21218bec097ce39d8 | e2a2b0d48ec4a987c1115753eb8c8e87b8325827 | coolsnady/hcd | /connmgr/tor.go | Go | go | 3,435 | permissive | // Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2017 The Decred developers
// Copyright (c) 2018-2020 The Hcd developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package connmgr
import (
"encoding/binary"
"errors"
"net"
)
const (
... |
a3f4b6283bc07048d7fba23964588af1cd9e216a | c0651f347c083eab5e09ef722d734bd10d1b7b53 | jiafenggit/GoWebSSH | /main.go | Go | go | 222 | no_license | package main
import (
_ "github.com/who246/GoWebSSH/routers"
"github.com/astaxie/beego"
"github.com/who246/GoWebSSH/models"
_ "github.com/who246/GoWebSSH/filter"
)
func main() {
models.CreateTable()
beego.Run()
}
|
c6ff83a3e50ea896c3645882bc3bce83d5c83c1b | db425825dfd00a3dee935640f9c94e653923c586 | DuoSoftware/pe-review | /src/processengine/Activities/CloudCharge_CardDelete/CloudCharge_CardDelete.go | Go | go | 3,530 | no_license | package CloudCharge_CardDelete
import (
"encoding/json"
"errors"
httpservice "processengine/Activities/HTTP_DefaultRequest"
"processengine/context"
"processengine/logger"
"strings"
)
func Invoke(FlowData map[string]interface{}) (flowResult map[string]interface{}, activityResult *context.ActivityContext) {
//c... |
d020e5708402839967e6b4c7bfe0f27cd120fefb | 70ebe0c836723593b35353cafc96e928c3e4b213 | borh/natsume-cabocha-bindings | /examples/example-server.go | Go | go | 3,202 | no_license | /*
Copyright (c) 2012 Bor Hodošček. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following ... |
f31944390fbbaf65409dfca01476bcf4526d0292 | 7d50f172d34388ec716456726caa25122adfe690 | blablacar/istio | /pilot/pkg/model/service.go | Go | go | 31,477 | permissive | // 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 law or agreed to in wri... |
c1924e350f488fe139154389035cfbcbd8197322 | f9fef764f003be9f53e63fd35a5933de05fee0d1 | quicklygabbing/http | /internal/pkg/http/request.go | Go | go | 773 | permissive | package http
import (
"net/http"
"github.com/quicklygabbing/http/internal/pkg/http/handle"
)
// Requests is implements router of http server.
type Request interface {
// Returns response with error 404 code.
NotFound() http.Handler
// Returns response for not allowed methods (GET/POST etc).
MethodNotAllowed() ... |
721f7b688cec1712cab10a1e4bb4546a5aaba64a | 3da81717df1311a245b46c7972e99f780b5c24bc | appootb/grpc-gen | /protoc-gen-markdown/templates/markdown/register.go | Go | go | 492 | permissive | package markdown
import (
"text/template"
"github.com/appootb/grpc-gen/v2/protoc-gen-markdown/templates/shared"
pgs "github.com/lyft/protoc-gen-star"
)
func Register(tpl *template.Template, params pgs.Parameters) {
shared.Register(tpl, params)
template.Must(tpl.Parse(fileTpl))
template.Must(tpl.New("service").... |
115d92af10c9c5f5d82b6efe2ae8250fb73b1d9c | be8055917d1e58076a5ad39b803b439f30a3ad19 | skyl/pango | /src/pango/lib/mathutil/multiples.go | Go | go | 318 | no_license | package mathutil
// MultiplesOf gathers the multiples of a given integer between
// low and high and returns the answer as a slice
func MultiplesOf(of int, low int, high int) []int {
ret := make([]int, 0)
for i := low; i <= high; i++ {
if ((i % of) == 0) {
ret = append(ret, i)
}
}
return ret
}
|
3734ca7e2906cc85e606b8d8b4bf36bae65bd876 | 8142f14804b567eedec919e262149b6f454f6bda | decibelcooper/eicplot | /axis.go | Go | go | 2,851 | no_license | package eicplot
import (
"math"
"strconv"
"gonum.org/v1/plot"
)
type LogScale struct{}
func (LogScale) Normalize(min, max, x float64) float64 {
logMin := log10(min)
return (log10(x) - logMin) / (log10(max) - logMin)
}
func log10(x float64) float64 {
if x <= 0 {
return -1
}
return math.Log10(x)
}
type Pr... |
b9da915e8b9be685449781153a5c94f3e33e36cf | 61a97590eae84790070d3fed3cb64611145aea91 | ExiaHan/oatdump_plus | /build/art.go | Go | go | 8,568 | permissive | // Copyright (C) 2016 The Android Open Source Project
//
// 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 applica... |
fcfd475c9b9dafb082f297330bd530560831b36a | 5ed6a61e9188a614d5e4d03444f7e957ff20773d | initinf/sensu-go | /backend/store/cache/v2/cache_test.go | Go | go | 5,701 | permissive | package v2
import (
"context"
"reflect"
"testing"
"go.etcd.io/etcd/integration"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
"github.com/sensu/sensu-go/backend/store"
storev2 "github.com/sensu/sensu-go/backend/store/v2"
"github.com/sensu/sensu-go/backend/store... |
38be2f0cfeff910680244edd86a16aaddc87bfa7 | 501f4b0cc6b37560a6a3f0714165feb3d7dff275 | simonshi2016/rook | /tests/framework/installer/ceph_manifests.go | Go | go | 49,732 | permissive | /*
Copyright 2016 The Rook Authors. 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 ... |
6a7134bb8138890828f6c701b04dcd443584e3a4 | 0fc902415cce9e4914c1cb9cedf545bde32b6bb8 | OlexandrPodustov/personalPerformance | /kickstart/2022/rA/challengeNine/main.go | Go | go | 1,011 | no_license | package main
import (
"fmt"
"log"
"strconv"
)
func main() {
var testCases int
if _, err := fmt.Scanln(&testCases); err != nil {
log.Fatal("testCases err", err)
}
for caseNumber := 1; caseNumber <= testCases; caseNumber++ {
var given int
if _, err := fmt.Scanln(&given); err != nil {
log.Fatal("given",... |
341149abf5350a6412a640750895d45938878f8c | c6f035944638a8d28c32052c993d410a37ac9a68 | Insh3ll/martian | /marbl/modifier.go | Go | go | 1,409 | permissive | // Copyright 2015 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 applicable... |
f60decd33877cbf188b7a74b157e728afc81e284 | d9d050ff4913f775f70948796747be78565c0cef | batazor/k8s-operator | /vendor/github.com/operator-framework/operator-sdk/pkg/generator/alm_catalog_tmpl.go | Go | go | 3,344 | permissive | // Copyright 2018 The Operator-SDK 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 ... |
06f1cea25df30b7913cd668e48511eee7e7a5fcc | 176281c1e6be24c161e781f43254e6c08c5eeba8 | tdkr/behavior3go | /core/Action.go | Go | go | 810 | no_license | package core
import (
b3 "github.com/tdkr/behavior3go"
. "github.com/tdkr/behavior3go/config"
)
type IAction interface {
IBaseNode
}
/**
* Action is the base class for all action nodes. Thus, if you want to create
* new custom action nodes, you need to inherit from this class. For example,
* take a look at the... |
73d3a129de554ee8a8047e71575e1423d55263bb | 158cb3e642ae68ae30488b3b51acf5bf685703a2 | nuclyde-io/flytepropeller | /pkg/controller/nodes/task/event_recorder.go | Go | go | 550 | permissive | package task
import (
"context"
pluginCore "github.com/lyft/flyteplugins/go/tasks/pluginmachinery/core"
)
type bufferedEventRecorder struct {
ev []pluginCore.PhaseInfo
}
func (b *bufferedEventRecorder) RecordRaw(ctx context.Context, ev pluginCore.PhaseInfo) error {
b.ev = append(b.ev, ev)
return nil
}
func (b... |
4454824d01337e0833aaf58022d2dfcdca495716 | f0b247b54885655dd8138d6d4a424e5acd9661f0 | hi-im-aren/pipeline | /internal/providers/azure/pke/workflow/create_route_table_activity_test.go | Go | go | 1,475 | permissive | // Copyright © 2019 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 ... |
a20a2de0752fe11d52e9c46b3b2ee1f18c4b2d1b | 0123849c8306b8b0b4a37ba745147acceffb5fb6 | Thiht/smocker | /server/admin_server.go | Go | go | 3,716 | permissive | package server
import (
"crypto/tls"
"html/template"
"io"
"net/http"
"strconv"
"github.com/Thiht/smocker/server/config"
"github.com/Thiht/smocker/server/handlers"
"github.com/Thiht/smocker/server/services"
"github.com/facebookgo/grace/gracehttp"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/mi... |
7e088b08b5cd7a43ce0cba1ae06e52f14a2a48e4 | 7a1ba772007fa05f554a96fe0953bcb9f3c307b9 | spear-it/zlint | /lints/rfc/lint_ecdsa_ee_invalid_ku.go | Go | go | 3,109 | permissive | /*
* ZLint Copyright 2020 Regents of the University of Michigan
*
* 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... |
354d1e7c442d3d04c17beeb40415ddd5648f628b | 7e6375d4aec49422da611974cefb3fe2b5ebe57d | mareebsiddiqui/grafana | /pkg/api/api.go | Go | go | 17,865 | permissive | package api
import (
"github.com/go-macaron/binding"
"github.com/mareebsiddiqui/grafana/pkg/api/avatar"
"github.com/mareebsiddiqui/grafana/pkg/api/dtos"
"github.com/mareebsiddiqui/grafana/pkg/middleware"
m "github.com/mareebsiddiqui/grafana/pkg/models"
)
// Register adds http routes
func (hs *HTTPServer) registe... |
c84ee15b9bc3ab892c7032b4a31d29fc601086f7 | 4984236183d32c34aca8853761ed0e653f0590e0 | dah8ra/golangtraining | /src/github.com/dah8ra/ch4/github/create.go | Go | go | 865 | no_license | package github
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func CreateIssues(jsonStr []byte) (*Issue, error) {
req, _ := http.NewRequest("POST", Url, bytes.NewReader(jsonStr))
req.Header.Set("Authorization", token)
req.Header.Set("Content-Type", "application/json")
client := new(http.Client)
resp, er... |
8d251ec81af9e89c612f154ef6dc8e694dad66e7 | 6a5ea9665a080796e902a37124f848a9d2d5d369 | deapers/exampers | /src/trade/global.go | Go | go | 8,393 | no_license | package trade
import (
"database/sql"
"errors"
"github.com/google/logger"
)
var (
GDBCon *sql.DB
GLogPath string
GLogVerbose bool
GRPCPort string
GDBurl string
GMap_Fund map[string]TFundinfo
GMap_Money map[string]TMoneyProduct
GMap_Param map[string]TSysParameter
GMap_ParamRe... |
45cdba1ac76de3683ef7c506860b171c19f53824 | 2a6001318c3ffbdddfdfb688ea041a8b329c4406 | middleware2018-PSS/Back2School | /actions/render.go | Go | go | 373 | no_license | package actions
import (
"io"
"github.com/gobuffalo/buffalo/render"
)
var r *render.Engine
func init() {
r = render.New(render.Options{
DefaultContentType: "application/json",
})
}
func customJSONRenderer(payload string) func(io.Writer, render.Data) error {
return func(w io.Writer, d render.Data) error {
... |
81baa5ab3839f948b292539a9bfce496d4f09bb0 | 9624cb4f173e47c7a1628a1780cb9f18acc357dd | hanhua111/go_leetcode | /5543lc.go | Go | go | 806 | no_license | package main
import (
"fmt"
)
//func maxLengthBetweenEqualCharacters(s string) int {
// var res int = -1
// var data = make(map[byte]int)
// for ind, val := range s{
// //注意val的类型是int,所以要用byte转为字符类型
// if i,ok := data[byte(val)]; ok{
// k := ind-i-1
// if k > res{
// res = k
// }
// }else{
// ... |
03efc7efb0e2ad60901ca44b723c9348de0d7e9c | 1f4d2358967dabced320733f91464060efd123fc | alistairewj/healthcare | /deploy/rulegen/resource_test.go | Go | go | 1,809 | permissive | package rulegen
import (
"testing"
"github.com/GoogleCloudPlatform/healthcare/deploy/testconf"
"github.com/google/go-cmp/cmp"
"gopkg.in/yaml.v2"
)
// TODO: add a test case for remote audit project once test configs
// can be generated with a remote audit project.
func TestResourceRules(t *testing.T) {
configDat... |
bc3a96246df83c2d4cd79ef2f5e8d39d67536131 | d06230e4ab69b26a73fffd1694885ec2df9c149e | isabella232/k3d | /pkg/cluster/cluster.go | Go | go | 25,113 | permissive | /*
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute,... |
1e49c1688a08d2f3782b897103efd4652d54f1b0 | b96402a7c0facd230456c5efc5925b094436418c | cooleraid/gomicroservice | /consignment-service/main.go | Go | go | 2,301 | no_license | // shippy-service-consignment/main.go
package main
import (
"context"
"log"
"net"
"sync"
// Import the generated protobuf code
pb "github.com/<YourUserName>/shippy-service-consignment/proto/consignment"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
const (
port = ":50051"
)
type repository... |
0997518a810fe71e61a791e7b9a48c9dc15565a2 | 51a72f255209738045495dd6656fd265c36f69fb | ZYK1236/Homework_Go | /learn.go | Go | go | 2,110 | no_license | package learn
import (
"fmt"
"sync"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/middleware/logger"
"github.com/kataras/iris/v12/middleware/recover"
)
type Person struct {
Name string `json:"name"`
Pwd int `json:"pwd"`
}
func Learn() {
app := iris.New()
// 错误捕获 recover
app.Use(recover.Ne... |
73e1c1896bdbed1e55c7229fa9d72cbd5795861c | 66e605a8712d345549c253b001120dead573ed55 | mengseeker/prometheus-es-adapter | /pkg/elasticsearch/write.go | Go | go | 3,223 | permissive | package elasticsearch
import (
"context"
"fmt"
"math"
"time"
elastic "github.com/olivere/elastic/v7"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/prompb"
"go.uber.org/zap"
)
type prometheusSample struct {
Labels model.Metric `jso... |
4f280d6c5e2ee8c1bd47d0d4ebf60a7c274747df | fb618900e8ccb9368e64249928c0ae5113a6ae5b | EwanValentine/capuchin | /cluster/cluster_test.go | Go | go | 1,230 | no_license | package cluster
import (
"sync"
"testing"
"github.com/EwanValentine/capuchin/conf"
"github.com/EwanValentine/capuchin/internal/etcd"
"github.com/stretchr/testify/require"
)
var (
once sync.Once
clusterService *Cluster
start = 20190101
end = 20200101
)
func setUp(t *testing.T) ... |
1095dcb31e8d254a3d68ec271d5ca91e7d292586 | 11dd0ce2bcc013665fe297badcc52aa3d595ca72 | angaz/golucene | /core/codec/lucene41/postingsReader.go | Go | go | 42,283 | permissive | package lucene41
import (
"fmt"
"github.com/jtejido/golucene/core/codec"
. "github.com/jtejido/golucene/core/codec/spi"
. "github.com/jtejido/golucene/core/index/model"
. "github.com/jtejido/golucene/core/search/model"
"github.com/jtejido/golucene/core/store"
"github.com/jtejido/golucene/core/util"
)
// Lucene... |
cfe2900f13d9e4e00601c7bfb07d2b0ad8dc2a6d | 28560969c04d95657f6eb1e86726187342ca3108 | slaveofcode/simple-rest-golang | /src/logger.go | Go | go | 327 | no_license | package main
import "time"
import "log"
import "net/http"
func Logger(inner http.Handler, name string) http.Handler {
return http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
start := time.Now()
inner.ServeHTTP(w, r)
log.Printf("%s\t%s\t%s\t%s", r.Method, r.RequestURI, name, time.Since(start),... |
ea206d103b8952210220b0e81a8e9a75b7c8b225 | ae38d348732420d67dda49e706861c8963ef2ccf | jhump/google-cloud-go | /internal/generated/snippets/dialogflow/cx/apiv3/IntentsClient/DeleteIntent/main.go | Go | go | 1,181 | permissive | // Copyright 2021 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
f849802b6602fceeb3e725b307ce25381d6a4e19 | b3ccc079bde9ae49d78e9fba7990b95661864f23 | tYYGH/rclone | /cmd/ncdu/ncdu.go | Go | go | 18,755 | permissive | // Package ncdu implements a text based user interface for exploring a remote
//+build !plan9,!solaris,!js
package ncdu
import (
"context"
"fmt"
"path"
"reflect"
"sort"
"strings"
"github.com/atotto/clipboard"
runewidth "github.com/mattn/go-runewidth"
termbox "github.com/nsf/termbox-go"
"github.com/pkg/err... |
09374e39ae14ef558dc6e76e48c247266dc5a0c4 | 9e80114d2f5e0477864cc1ae7fd93939e7c43603 | Abirdcfly/cluster-api-provider-nested | /virtualcluster/pkg/syncer/resources/secret/dws_test.go | Go | go | 21,370 | permissive | /*
Copyright 2020 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 writing, ... |
d6b5083afedde5557c016fe3d44aa65273fb3de4 | ab885fa7229f91f308dc83e140511b54ee360ab8 | kunal-kushwaha/kubevirt | /pkg/virt-launcher/virtwrap/api/defaults_test.go | Go | go | 1,252 | permissive | package api
import (
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("ArchSpecificDefaults", func() {
table.DescribeTable("should set architecture", func(arch string, targetArch string) {
domain := &Domain{}
NewDefaulter(arch).SetDefaults_OST... |
5a8343a60e9376e5b9f4b97ff76b1b202bdb4fbc | 8a6ed8a721cee62257b906c168fdea0d8ca82ca4 | raleighlittles/Introduction-to-Programming-in-Go_SOLUTIONS | /chapter3/chapter3.go | Go | go | 763 | no_license | package main
import "fmt"
func main() {
problem1()
problem2()
problem3()
problem4()
problem5()
}
func problem1() {
fmt.Println(`Integers are stored on computers in bytes, where each byte is composed of 8 bits.`)
}
func problem2() {
fmt.Println(`The largest 8 digit number in binary is '11111111', which is 255... |
753b61fa579a1537e9a0a7513cddd3e02fea8b08 | 245108ba6721f432fd4e8529b8957a9e28c60c6a | YuanDdQiao/easypos | /vendor/github.com/go-macaron/cache/ledis/ledis.go | Go | go | 4,521 | permissive | // Copyright 2014 The Macaron 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... |
9ac22d310886c97d130fd629a7cfaab5c711d604 | 576cda60cb8777f3952ad71b1699c016ac722b04 | andreasatle/go-design-patterns | /01-creational-design-patterns/02-builder/main/main.go | Go | go | 435 | no_license | package main
import (
"fmt"
"github.com/andreasatle/go-design-patterns/01-creational-design-patterns/02-builder/house"
)
func main() {
normalBuilder := house.GetBuilder("normal")
iglooBuilder := house.GetBuilder("igloo")
director := house.NewDirector(normalBuilder)
normalHouse := director.BuildHouse()
fmt.Pr... |
d39420f10ec91f23ce37941ba9def15cd4f270cb | 88ca207eb2040eee3a3d5ad0a888b92404aef8a9 | mrinjamul/gtodo | /cmd/done.go | Go | go | 1,890 | permissive | /*Package cmd ...
Copyright © 2020 Injamul Mohammad Mollah
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... |
13dc1155c330b1cdbd4337ad625ceb8d86b417b9 | d5c428ce2e273fd1bd7a6999d134617b09abc797 | CoderShubham2000/MLH-Local-HackDay | /BudgetApp/vendor/github.com/go-pg/migrations/v8/collection.go | Go | go | 14,997 | permissive | package migrations
import (
"bufio"
"bytes"
"errors"
"fmt"
"io/ioutil"
"math"
"net/http"
"os"
"path"
"path/filepath"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"sync"
"github.com/go-pg/pg/v10"
)
type Migration struct {
Version int64
UpTx bool
Up func(DB) error
DownTx bool
Down func(DB)... |
2ea22b22011e4b20c35dba05f117f224ad508e4e | 62a88d1ffe7187300a5f33bd76be9638bb8d0594 | eudaemonic-one/Lifelong-Learning | /LeetCode/Golang/surrounded-regions.go | Go | go | 1,118 | no_license | func solve(board [][]byte) {
if (len(board) == 0 || len(board[0]) == 0) {
return
}
for i := 0; i < len(board); i++ {
dfs(board, 'E', i, 0)
dfs(board, 'E', i, len(board[0])-1)
}
for j := 0; j < len(board[0]); j++ {
dfs(board, 'E', 0, j)
dfs(board, 'E', len(boa... |
97f1606c9a19d6b7850c757fd00befaac1da3021 | c08f1a8d9e3f2b70bb3586efa4ff6d9d48cb9ecb | fspace/go-playground | /netexamples/myzinx/internal/znet/router.go | Go | go | 390 | permissive | package znet
import "playgo/netexamples/myzinx/internal/ziface"
type BaseRouter struct {
}
func (br *BaseRouter) PreHandle(request ziface.IRequest) {
//panic("implement me")
}
func (br *BaseRouter) Handle(request ziface.IRequest) {
//panic("implement me")
}
func (br *BaseRouter) PostHandle(request ziface.IReques... |
7f8df7f31782d5c4beedff5f1cdfbbee61587e00 | e8bb93f19f0c1437a329ab9592e9ca955e3b5d6b | bonly/exercise | /2013/201312/20131216_cgo_enum.go | Go | go | 252 | no_license | package main
/*
enum levels {
low1,
medium,
high
};
typedef enum {
LOW = 0,
MEDIUM = 1,
HIGH = 2
} security;
*/
import "C"
import "fmt"
func main() {
cc := new(C.enum_levels)
fmt.Println(*cc)
fmt.Println(C.MEDIUM)
} |
f39517c5bba569633de95d6288fbdb6939dab652 | 7683f4afbef7c8864c08c5168f975ed1bed01fad | decred/dcrlnd | /watchtower/wtmock/keyring.go | Go | go | 2,008 | permissive | package wtmock
import (
"sync"
"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/decred/dcrlnd/keychain"
)
// SecretKeyRing is a mock, in-memory implementation for deriving private keys.
type SecretKeyRing struct {
mu sync.Mutex
keys map[keychain.KeyLocator]*secp256k1.PrivateKey
}
// NewSecretKeyRing c... |
b19fc5b620d7d79629e3d380f42cf3771cedded3 | 14c717039193e56de3bea76a2f7d0ede278313d9 | m3ng9i/godi | /di/di.go | Go | go | 4,958 | no_license | // Package di calls 'go list' command to gather information about go package dependency.
package di
import "strings"
import "strconv"
import "encoding/json"
import "os/exec"
import "errors"
import "github.com/m3ng9i/go-utils/cmd"
// max length of "go list" command line parameters
var maxChars = 8000
// PkgInfo sto... |
b6f1aeb21af294eab77a07a76a75db0d10ba27de | b2358e09f098e31ffad0075792e9c49947b81740 | kedacore/keda | /vendor/github.com/DataDog/datadog-api-client-go/api/v1/datadog/model_usage_top_avg_metrics_hour.go | Go | go | 7,326 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
package datadog
import (
"encoding/json"
)
// UsageTopAvgMetricsHour Number of ho... |
e4ce6d1f6e15ffd2300bcaaaf7ce893b29ea90d6 | 0cbfb30eef8b4cd3c6faec4b95240330a3a6d8f3 | cwx-hannoschulz/sftp-exporter | /pkg/utils/utils_test.go | Go | go | 4,971 | no_license | package utils_test
import (
"fmt"
"reflect"
"runtime"
"testing"
"github.com/arunvelsriram/sftp-exporter/pkg/internal/mocks"
"github.com/arunvelsriram/sftp-exporter/pkg/utils"
"github.com/stretchr/testify/assert"
"golang.org/x/crypto/ssh"
)
func TestIsEmpty(t *testing.T) {
tests := []struct {
name stri... |
a3aafaca8672ac61010f6e689c633a8a59e77164 | 68a97d178aca7cc707fd4d6ed0b63135f72f02d2 | vuong177/irismod | /modules/farm/module.go | Go | go | 6,767 | permissive | package farm
import (
"context"
"encoding/json"
"fmt"
"math/rand"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "gi... |
e0417423ed26379b11739784be7bb0289359fdb0 | 796e8914967c2cee118846d5358d7b71cca408bc | shakti-das/istio | /pilot/pkg/model/proxy_config_test.go | Go | go | 10,889 | permissive | // 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 law or agreed to in wri... |
ce01ac899a98012098ebcca1b0268f91ed6d404c | ad8acfca6656bd6b7b2dfc0875fd1d23f2f7dad5 | ogre0403/leaderz | /main.go | Go | go | 2,357 | no_license | package main
import (
"context"
"flag"
"sync/atomic"
"time"
"github.com/apex/log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/leaderelection"
"... |
2f493e2da06bfd66bb03dcec4fc79ec7d30ce5a2 | 9d9ade7b0a93179e4b82b190f6d2eed7a04d255a | globalways/notifications | /models/clients_repo_test.go | Go | go | 3,756 | permissive | package models_test
import (
"path"
"time"
"github.com/cloudfoundry-incubator/notifications/config"
"github.com/cloudfoundry-incubator/notifications/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ClientsRepo", func() {
var repo models.ClientsRepo
va... |
4bea9c5be6ad0fe0b4a2dec715752ba658d6eaae | abc2d9d7b9abf102656782e34ccdef216c06c5b3 | IBM-Blockchain/generator-fabric | /generators/contract/templates/v2/private/go/main.go | Go | go | 1,101 | permissive | /*
* <%= spdxAndLicense // SPDX-License-Identifier: Apache-2.0 %>
*/
package main
import (
"github.com/hyperledger/fabric-contract-api-go/contractapi"
"github.com/hyperledger/fabric-contract-api-go/metadata"
)
func main() {
<%= assetCamelCase %>Contract := new(<%= assetPascalCase %>Contract)
<%= assetCamelCase... |
4e691af9d1451c35c78502c50e2e6d181f9381a8 | ce375f95765037b29baca1cc2ddd19fbaa8bf2ba | MichaelAquilina/client | /go/fuzz/saltpack_verify/fuzz.go | Go | go | 1,653 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
// +build gofuzz
package saltpack
import (
"encoding/hex"
"errors"
"fmt"
"github.com/agl/ed25519"
"github.com/keybase/saltpack"
)
type sigPubKey struct {
key [ed25519.PublicKeySize]byte
}
... |
aa5727bb98da1ed8712303e9953f2a82cc445ce8 | 72cd2061fe659bb1b396117b7495b4c073923f2e | alexeykobzev/tailon | /server.go | Go | go | 5,922 | permissive | package main
import (
"encoding/json"
"github.com/gorilla/handlers"
"github.com/alexeykobzev/tailon/cmd"
"github.com/alexeykobzev/tailon/frontend"
"github.com/shurcooL/httpfs/html/vfstemplate"
"github.com/shurcooL/httpgzip"
"gopkg.in/igm/sockjs-go.v2/sockjs"
"html/template"
"log"
"net/http"
"os"
"os/exec"
... |
92d13859e25df982a2e2deeae9034a090a2d2fe0 | 6d2c263b530b6b1e74c1f140ff87d30261cdf0b7 | atdevp/xalarm | /routers/router.go | Go | go | 1,143 | no_license | // @APIVersion 1.0.0
// @Title Xalarm API
// @Description xalarm by wechat
// @Contact root.db.root@gmail.com
package routers
import (
"xalarm/controllers"
"github.com/astaxie/beego"
)
func init() {
beego.Router("/api/tags/list", &controllers.ImtagController{}, "*:ListTag")
beego.Router("/api/tags/create", &cont... |
99234f5a5383ff7dacd0fa418df6411e8d54e289 | fea0a965c02794b8944bf6938ffb60e973c5df3a | kevinyohe/go_garden_code | /deviceloader.go | Go | go | 383 | no_license | package main
import (
"awesomeProject/devicedata"
"fmt"
"time"
)
func main() {
fmt.Println("Hello, playground")
a := devicedata.DeviceData{Name: "test123", Command: "show ip br", Data: ""}
fmt.Println(a.Name)
a.Name = "new name"
fmt.Println(a.Name)
a.Save()
fmt.Print(time.Now())
fmt.Println()
dt:= tim... |
2c32d6f641e1ed2eeb6166428c9693563c4991ad | 655e933251b747e0e824375ccb1b18a805948432 | nelsw/quivlet-sam | /util/api/api_test.go | Go | go | 886 | permissive | package api
import (
"github.com/aws/aws-lambda-go/events"
"github.com/nelsw/quivlet-sam/model"
"testing"
)
func TestLog(t *testing.T) {
Log(events.APIGatewayProxyRequest{
Resource: "resource",
Path: "path",
HTTPMethod: "method",
RequestContext: events.APIGatewayProxyRequestContext... |
fd727ff88b9d87d1f4460e88b86f64993dce255f | 768d4462b6935887ac40980098a714e4d4d4c012 | liuxiaozhen/ipip-go | /ipip/ip.go | Go | go | 1,354 | no_license | package ipip
import (
"encoding/binary"
"io/ioutil"
"net"
)
type Ipip struct {
offset uint32
index []byte
binary []byte
}
func NewIpip() *Ipip {
return &Ipip{
offset: 0,
}
}
func (p *Ipip) Load(path string) error {
b, err := ioutil.ReadFile(path)
if err != nil {
return err
}
p.binary = b
p.offset ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.