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 |
|---|---|---|---|---|---|---|---|---|
2507722f3e600748bb0e22fdbec7c25fc1b44c9e | 570bfb5de60286bb96838f56a40c91d816b3308d | bencaggia/buf | /internal/buf/bufcheck/bufbreaking/vars.go | Go | go | 18,247 | permissive | // Copyright 2020 Buf Technologies 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 ag... |
2d23c3fda7f901bd6e555d62ab8c713cb5d850aa | c8fc0db112cadac5eaec2a73f73b2c274bab84b8 | d954mas/defold-platformer-kit | /platformer_creation_kit/building_blocks/gameobjects/props/rock_prop2.go | Go | go | 386 | no_license | embedded_components {
id: "sprite"
type: "sprite"
data: "tile_set: \"/platformer_creation_kit/framework/atlases/level.atlas\"\n"
"default_animation: \"stone2\"\n"
"material: \"/builtins/materials/sprite.material\"\n"
"blend_mode: BLEND_MODE_ALPHA\n"
""
position {
x: 0.0
y: 49.45705
z: -0.6
... |
9305fab918dec8b045b2cce90d33bdce6f32de19 | e8688e1916d9b77819e71e2facd1015add35308b | mteodor/mainflux | /pkg/sdk/go/sdk.go | Go | go | 12,374 | permissive | // Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package sdk
import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/mainflux/mainflux"
"github.com/mainflux/mainflux/internal/apiutil"
"github.com/mainflux/mainflux/pkg/er... |
d982788d5c26b6e95f4b739bfcdaf93856112421 | 248d1e9c11ad4c0af6fceb27e47bd217628362e8 | rogervaas/eventnative | /schema/flattener_test.go | Go | go | 1,821 | permissive | package schema
import (
"github.com/jitsucom/eventnative/test"
"github.com/stretchr/testify/require"
"testing"
)
func TestFlattenObject(t *testing.T) {
tests := []struct {
name string
inputJson map[string]interface{}
expectedJson map[string]interface{}
}{
{
"Empty input json",
map[string... |
2cd007cd88512fdc51930a08777d5e44e1349afa | fb55ab846d2b47dd41f449dff79bc11b9475ba5e | monzo/libcalico-go | /lib/backend/syncersv1/bgpsyncer/bgpsyncer_suite_test.go | Go | go | 1,084 | permissive | // Copyright (c) 2017-2018 Tigera, 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 ap... |
02e4ecf04ff115b587c3f9cf8dee535301c6e916 | a630f5bfa1f270e86d75404346e8dea338077c91 | kubernetes/kubernetes | /vendor/github.com/google/cel-go/cel/program.go | Go | go | 19,972 | permissive | // Copyright 2019 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 ... |
397e761a3595eba155fd95b9ed0811923fbd9bac | 47d3935a16040f67966084fd9f036e1f70a29c3a | azamat02/online-courses-web-application-golang | /backend/cmd/main.go | Go | go | 579 | no_license | package main
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"online-courses-app/database"
"online-courses-app/routes"
)
func main() {
//DB connect
database.Connect()
//Creating application
app := fiber.New()
app.Use(cors.New(cors.Config{
Next: nil,
Allo... |
fdf9e653a44125be33283f14ccdfb66fa161e3ee | ee215393504596c425901350983cd157dc74b51f | dbsmash/field-promotion | /goapp/game.go | Go | go | 265 | permissive | package goapp
import (
"net/http"
"html/template"
)
func init() {
}
func MainHandler(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles("dist/index.html"))
err := tmpl.Execute(w, nil)
if err != nil {
panic(err)
}
} |
619368ecc0a164865dfc64b88259fddacbc549fe | e7a704e8ecf3c5f0be567d7cabe4ae0c92701564 | z-wade/algorithm004-01 | /Week 08/id_011/isomorphic-strings.go | Go | go | 271 | no_license | package algorithm00401
func isIsomorphic(s string, t string) bool {
m1 := make([]int, 256)
m2 := make([]int, 256)
for i := 0; i < len(s); i++ {
if m1[s[i]-'a'] != m2[t[i]-'a'] {
return false
}
m1[s[i]-'a'] = i + 1
m2[t[i]-'a'] = i + 1
}
return true
}
|
c32f95d1db64dd16e9b2f62ce43b2fe1a817d66c | bc91f66dd56a64a864b9752a47aa9805bbb742a8 | h4ck3rm1k3/gocore | /src/github.com/h4ck3rm1k3/gocore/cmd/internal/objfile/macho.go | Go | go | 2,792 | no_license | // Copyright 2013 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.
// Parsing of Mach-O executables (OS X).
package objfile
import (
"github.com/h4ck3rm1k3/gocore/debug/macho"
"github.com/h4ck3rm1k3/gocore/fmt"
"github.co... |
cb4bb4ec91759ba3ee0835095c285ccd20f32b43 | 8984ccb7d46290ba555ebeeaa2ade4c37d866fcf | hashicorp/azure-sdk-for-go | /tools/generator/autorest/model/changelog.go | Go | go | 5,802 | permissive | package model
import (
"fmt"
"strings"
"github.com/Azure/azure-sdk-for-go/tools/apidiff/delta"
"github.com/Azure/azure-sdk-for-go/tools/apidiff/markdown"
"github.com/Azure/azure-sdk-for-go/tools/apidiff/report"
)
// Changelog describes the changelog generated for a package.
type Changelog struct {
// NewPackag... |
e2becdc08b788f04463247c80e60842cd661deba | b19c3a27d8dc6e6e9e54219b1817763decc62d45 | jibben/pagecard | /content/reader_test.go | Go | go | 1,772 | permissive | package content
import (
"io/ioutil"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
const fixture = `
<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="apple-itunes-app" content="foo app">
... |
f5d8952d73a3333ac78b661f8893a6bb058caafd | ef904e2af5aa72d917aabdd827b682067c905b41 | aristanetworks/openconfigbeat | /vendor/github.com/elastic/beats/x-pack/filebeat/input/netflow/decoder/test/helper.go | Go | go | 1,900 | permissive | // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
package test
import (
"bytes"
"encoding/binary"
"net"
"strconv"
"testing"
"g... |
b5b04a1447b0dcf7c9f2ee523a509b31cf2c1d4f | 09d08d278c2dbe349b4c92ba0e8771eb16de7a73 | winesier/neo4j-go-driver | /neo4j/summary_collection.go | Go | go | 5,983 | permissive | /*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* 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/license... |
68ede9e2cb1760eee14369f54581c01ab056b15f | c37e536bbd30606da38f930aec9b0a4f943c3949 | udistrital/agora_api_crud | /models/informacion_persona_juridica.go | Go | go | 6,042 | no_license | package models
import (
"errors"
"fmt"
"reflect"
"strings"
"github.com/astaxie/beego/orm"
)
type InformacionPersonaJuridica struct {
Id int64 `orm:"column(num_nit_empresa);pk"`
DigitoVerificacion float64 `orm:"column(digito_verificacion)"`
Procedenc... |
6cd203012b98c3b5aee90e8106c7730e896b22a5 | cdef89574812aa65c17c4d7feed336f92683b1d1 | kluster-api/cluster-api | /cmd/clusterctl/client/cluster/mover.go | Go | go | 36,098 | 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, ... |
f24e1a2e38b401f97440cf67cdc6274ec237c7ae | a9a57f81a12ec897b32f4010c3474bcbd092621d | cloudfoundry-community/portcullis | /broker/bindparser/bindparser_suite_test.go | Go | go | 343 | permissive | package bindparser_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
"github.com/starkandwayne/goutils/log"
)
func TestBindparser(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Bindparser Suite")
}
var _ = BeforeSuite(func() {
log.SetupLogging(log.LogConfig{Type: "console... |
e8a203fb6247cfec8f49f8acb12803fa82b60ea6 | 7929f8bd84a44daf378ddccab17e0b0dbba3307b | paulndam/go-linear-ds | /linkedlist.go | Go | go | 3,878 | no_license | package main
import "fmt"
//node class with property int and nextNode which points to the Node class
type Node struct{
property int
nextNode *Node
previousNode *Node
}
type LinkedList struct {
headNode *Node
}
func (linkedList *LinkedList) AddToHead(property int){
var node = Node{}
node.property = property... |
b3f83983292d81deb999cf14fb901f39872aa1cf | 66a977835fcb128601e1bb747aa92d2efaa0889b | gqgs/GoZeroNet | /pkg/lib/random/random.go | Go | go | 1,373 | no_license | package random
import (
"crypto/rand"
"math/big"
"strings"
)
type alphabet string
const base62Alphabet alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
const hexAlphabet alphabet = "abcdef0123456789"
// Returns a random byte contained in the alphabet.
// This method panics if there is ... |
6816b09099cec6ba0bf1b4f83866ba33d4b72e75 | 60b599000d0a2f14eeaec478255ae6a928599c6c | ava-labs/avalanchego | /utils/maybe/maybe_test.go | Go | go | 1,408 | permissive | // Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package maybe
import (
"testing"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"
)
func TestMaybeClone(t *testing.T) {
require := require.New(t)
// Case: Value is maybe
{
val := []by... |
0f44256d17dc3492aa80e646f60315bc07d04f45 | 3cc7ed06214737651bd5f25c2799b16926283950 | Zeikk/Api_Patient | /control/user.go | Go | go | 1,702 | no_license | package control
import(
"fmt"
"log"
"net/http"
db "api_patient/db"
"encoding/json"
"time"
"github.com/dgrijalva/jwt-go"
)
type User struct {
IdPersonne string `json:"id"`
Password string `json:"password"`
}
type Claims struct {
IdMedecin string `json:"id"`
jwt.StandardClaims
}
func LoginMedecin(w http.Re... |
5d10d4aca3a450fced717c9f7b200760b7e83aa5 | 6ea98458aa492dd9937282bc5fac3a56031956c8 | philipsahli/openshift-dashboard | /Godeps/_workspace/src/github.com/openshift/origin/pkg/image/api/v1beta3/types.go | Go | go | 4,447 | permissive | package v1beta3
import (
kapi "k8s.io/kubernetes/pkg/api/v1beta3"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
// ImageList is a list of Image objects.
type ImageList struct {
kapi.TypeMeta `json:",inline"`
kapi.ListMeta `json:"metadata,omitempty"`
Items []Image `json:"items"`
}
// Image is ... |
04de29626e666fa2288bbe65e8ed640eecdb72db | ae2d600dd984ec82f2b876e627d3501ab81268c2 | AdguardTeam/golibs | /netutil/subnetset_test.go | Go | go | 8,903 | permissive | package netutil_test
import (
"net"
"testing"
"github.com/AdguardTeam/golibs/netutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestSubnetSet_optimized(t *testing.T) {
t.Parallel()
spPurpSet := netutil.SubnetSetFunc(netutil.IsSpecialPurpose)
locSrvSet := netutil.Subne... |
5cef961a2138a4c4155664acb407e4cc63ef2a37 | 35a9577a567b0a234eae98a9aa73a6b79776d3b8 | wp-jackliu/opentaobao | /model/refund/RefundMappingResult.go | Go | go | 327 | permissive | package refund
// RefundMappingResult 结构体
type RefundMappingResult struct {
// 退款ID
RefundId string `json:"refund_id,omitempty" xml:"refund_id,omitempty"`
// 结果信息
Message string `json:"message,omitempty" xml:"message,omitempty"`
// 是否成功
Succ bool `json:"succ,omitempty" xml:"succ,omitempty"`
}
|
3c83fa9e16c2e5b93b37066ef1ab91cdc1f552b6 | 6d5e344c3ee6a40c74c05189b3d2fc033b057a38 | tianhucn/gf | /container/gvar/gvar.go | Go | go | 4,927 | permissive | // Copyright GoFrame Author(https://goframe.org). 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/dxasu/gf.
// Package gvar provides an universal variable type, like gene... |
ee64e7310b23088ed90b051cb9cd40b0508f06d7 | 767d7a328c087dbfbd87c54a5e53c424dfda4687 | gitter-badger/kubefaas | /pkg/controller/watchApi.go | Go | go | 6,428 | permissive | /*
Copyright 2016 The Fission 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, sof... |
c8550e50d806a26162a6fe586024561ca8eea934 | 408ea258ea2aa1873ff18475bf203fa9ea4dcdc8 | justmiles/golibs | /params/get.go | Go | go | 1,259 | permissive | package params
import (
"errors"
"fmt"
"os"
"strings"
)
var (
ErrOption = errors.New("option error")
ErrNoValue = errors.New("no value found")
)
// Get returns the value stored for a named environment variable,
// and a default if no value is found.
func (e *Env) Get(key string, optionSetters ...OptionSetter)... |
90e25b263349437d9a4dc8ac90d50a0fe9b31f35 | fa87302ee8caa3c223071db0296e6c3e8a0549be | gladiopeace/podman | /test/e2e/libpod_suite_remote_test.go | Go | go | 6,948 | permissive | // +build remote
package integration
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
"github.com/containers/podman/v2/pkg/rootless"
"github.com/onsi/ginkgo"
)
func IsRemote() bool {
return true
}
func SkipIfRemote(reason string) {
if le... |
9b8fe59aafe03f12cff5bd954263677132a6d50f | bd7f37ad21bbf15517b01761682cc8f9b2790c86 | tetrafolium/aws-sdk-go | /service/kms/kmsiface/interface_test.go | Go | go | 345 | permissive | // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package kmsiface_test
import (
"testing"
"github.com/tetrafolium/aws-sdk-go/service/kms"
"github.com/tetrafolium/aws-sdk-go/service/kms/kmsiface"
"github.com/stretchr/testify/assert"
)
func TestInterface(t *testing.T) {
assert.Implements(t, (*kmsiface.KMSAP... |
d7976501f40a430f7900c6b8f669c4a3641a9219 | 790698d95054a847d0c48879d3a7923391347989 | Nosp1/is105-ica03 | /servers/http_server/main_http_client.go | Go | go | 348 | permissive | package main
import(
"io/ioutil"
"log"
"net/http"
"os"
)
func main() {
resp, err := http.Get("http://localhost:8765/connected")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
_, err = os.Stdout.Write(body)
if err != n... |
2faa8adb51c523f6ecfcc51c85720e53d8953879 | 494124db2639f3c83a31818133d8e60ba2854c86 | anilaydinn/go-restful | /chapter1/romannumbers/src/github.com/anilaydinn/romanserver/main.go | Go | go | 1,131 | no_license | // main.go
package main
import (
"fmt"
"html"
"net/http"
"strconv"
"strings"
"time"
"github.com/anilaydinn/romanNumerals"
)
func main() {
// http package has methods for dealing with requests
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
urlPathElements := strings.Split(r.URL.Path, "... |
72f6f747b42ac84bdc7557e38e27c75d6404416f | f6883e631b4dc7e58833468f9c837e923f909aba | cjellick/types | /vendor/github.com/rancher/norman/clientbase/ops.go | Go | go | 6,794 | permissive | package clientbase
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"github.com/pkg/errors"
"github.com/rancher/norman/types"
)
func (a *APIOperations) setupRequest(req *http.Request) {
req.Header.Add("Authorization", a.Opts.getAuthHeader())
}
func (a *APIOperations) DoDelete(url string) ... |
4a98533d7fedfc385133b39cbdaaecbef3bc6dd9 | 75f3d768c06f1697403818c916433949d9348b71 | nandfan/upg-vpp | /test/e2e/pfcp/request_queue_test.go | Go | go | 2,705 | permissive | // request_queue_test.go - 3GPP TS 29.244 GTP-U UP plug-in
//
// Copyright (c) 2021 Travelping GmbH
//
// 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/licens... |
1df930881526f6ea690203f051828a6f220b4e4b | 8761acaf564b2b6f15b783f47eb365f6a1047de5 | benpoliquin/isopod | /pkg/runtime/runtime.go | Go | go | 10,496 | permissive | // Copyright 2019 GM Cruise 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 i... |
03f7c74301c04ac4d20ff313a679b084e2f1a9ea | 09e6d56ab22501bd17b8d00fceff48c440f70e96 | alveraboquet/linkcms | /binance/packages/crex/exchanges/okexswap/okexswap_test.go | Go | go | 2,730 | permissive | package okexswap
import (
. "github.com/koinotice/redox/packages/crex"
"github.com/koinotice/redox/packages/crex/configtest"
"testing"
"time"
)
func testExchange() Exchange {
testConfig := configtest.LoadTestConfig("okexswap")
params := &Parameters{}
params.AccessKey = testConfig.AccessKey
params.SecretKey =... |
e520fdf0066fae80bb50b58932684a39e4261afc | 0dd5e45604ee6cff30b5b700fefac7db646ab970 | suryanshv23/shooting_game | /player.go | Go | go | 1,318 | no_license | package main
import (
"go-sdl2-master/sdl"
"math"
"time"
)
const (
playerSpeed = 0.45
playerHeight = 150
playerWidth = 157
cooldown = time.Millisecond * 250
)
type player struct {
tex *sdl.Texture
x, y float64
lastshot time.Time
}
func newplayer(renderer *sdl.Renderer) ... |
c8280b0b3abf60c689937af88aabc546d6be1533 | ef0ad7de1d16e3bf1fb602e81126555fd056411f | parauliya/cluster-api-provider-tink | /controllers/machine.go | Go | go | 9,897 | 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, ... |
5a3d3defa85562901185ec5c0acd4ea1b88f2d15 | ed7eda52585b43bbc9aad7ada35bf9fbc1cf0fb8 | rckasa/awstaghelper | /pkg/iam_test.go | Go | go | 1,824 | permissive | package pkg
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/stretchr/testify/assert"
)
type mockedIamUser struct {
iamiface.IAMAPI
respListUsers iam.ListUsersOutput
respListUserTags iam.ListUserTagsOutp... |
dd7e5ff95af13dceecf598eb06ec42ce3e329ae9 | 5977228fc0080ea340f00eeec50746f35dc35302 | g-airport/go-infra | /errors/merr.go | Go | go | 485 | permissive | package errors
import (
"encoding/json"
errM "github.com/micro/go-micro/errors"
)
// micro server
func ParseRPCError(err error) *Error {
if err == nil {
return nil
}
errTxt := err.Error()
// split "micro error" layer
mErr := errM.Parse(errTxt)
errTxt = mErr.Detail
// try to parse to our service error
... |
ffd18c55779ac3d0739c4d43290040c6f42fc419 | d337105ad4c37b51f99191737ebb52f5a4ae6c36 | jonnycrunch/aries-framework-go | /pkg/didcomm/protocol/introduce/metadata.go | Go | go | 3,082 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package introduce
import (
"github.com/google/uuid"
"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/service"
"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/decorator"
"github.com/h... |
804c632150ae52214604fc050e16175a2edaec20 | eb590902eb7dd54a555f7ea3f234f2ba88bb0c6d | mayur-oci/ossGo | /Streaming101.go | Go | go | 2,610 | no_license | package main
import (
"context"
"fmt"
"strconv"
"time"
"github.com/oracle/oci-go-sdk/v36/common"
"github.com/oracle/oci-go-sdk/v36/example/helpers"
"github.com/oracle/oci-go-sdk/v36/streaming"
)
func main() {
fmt.Println("go running")
streamAdminClient, err := streaming.NewStreamAdminClientWithConfiguratio... |
b994da51fb0296186dbf8584c14ab0fc573abacf | 09bb7c27a0d25153847a78be637bbc5c3bf343c5 | XuHaoJun/dao | /configs.go | Go | go | 5,352 | no_license | package dao
import (
"gopkg.in/yaml.v2"
"io/ioutil"
"log"
"sync"
"time"
)
type ScriptLoadConfigs struct {
Imports []string `yaml:"imports,omitempty"`
Scripts []string `yaml:"scripts,omitempty"`
}
type EtcItemConfigs struct {
MaxStackCount int `yaml:"maxStackCount"`
}
type UseSelfItemConfigs struct {
MaxSta... |
5dfad7241f004628a4e990a52edc817b69ba523c | 69836921eb3a5751313419dad87d57c271ea215c | ademozay/gam | /err.go | Go | go | 320 | permissive | package main
import "errors"
var (
errMissingName = errors.New("missing alias name")
errMissingValue = errors.New("missing alias value")
errNoSuchAlias = errors.New("no such alias")
errNoChanges = errors.New("no changes")
errInvalidAction = errors.New("invalid action. type -h or --help to see usage")
)
|
45958ba01eeeab43ec215b5067d353775528eada | 9c419cfb96666fec04317c86c0f9f9dfca11088f | codegracie/gotraining | /starter-kits/http/internal/web/response.go | Go | go | 4,076 | permissive | // All material is licensed under the Apache License Version 2.0, January 2004
// http://www.apache.org/licenses/LICENSE-2.0
// Current Status Codes:
// 200 OK : StatusOK : Call is success and returning data.
// 204 No Content : StatusNoContent : Call is success and returns no ... |
a64e36dae678e39564a9e495f5db566cb630739c | bfb902730152d36d96807d3848e303f8e6db477c | archsaber/gopsutil | /disk/disk_freebsd.go | Go | go | 4,537 | permissive | // +build freebsd
package disk
import (
"bytes"
"context"
"encoding/binary"
"path"
"strconv"
"unsafe"
"golang.org/x/sys/unix"
"github.com/archsaber/gopsutil/internal/common"
)
func Partitions(all bool) ([]PartitionStat, error) {
return PartitionsWithContext(context.Background(), all)
}
func PartitionsWit... |
a917df29a9509b63e91dea15dafca37b45637299 | 3178fed115c19e0f5e38c267410197d43d66432b | yzhlove/Go | /action.com/src/redis_examp/chat23/main.go | Go | go | 490 | no_license | package main
import (
"fmt"
"os/exec"
)
/*
docker images | grep redis
docker pull redis
docker rm saved
docker run -d -p 6380:6379 --name saved redis
docker run -d -p 6379:6379 --link saved:saved -v /Develop/Docker/Volumes/Redis:/data redis
*/
func main() {
out, err := exec.Command("docker", "ps", "-a").Output()... |
64822844b22dcd4b648afa969e829ecb030ad124 | a14de2f712018f2316b94ccaebd1d1697ae59be3 | EvgeniyPatlan/percona-backup-mongodb | /pbm/pitr/pitr.go | Go | go | 13,331 | permissive | package pitr
import (
"context"
"fmt"
"strconv"
"strings"
"sync/atomic"
"time"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"github.com/percona/percona-backup-mongodb/pbm"
"github.com/percona/percona-backup-mongodb/pbm/backup"
"github.com/percon... |
45ee64dbad651b33c0e874870900d406205614e4 | 80c8d5a78a0e9c41800c484bb1c84bb98f3a5471 | project-symi/backend-symi | /app/interfaces/http_interface/http_handler.go | Go | go | 300 | no_license | package http_interface
type HttpHandler interface {
NewHttpRequest(string, string, []byte) error
SetHeader(string, string)
DoRequest() error
}
type Request interface {
Header
}
type Header interface {
Set(string, string)
}
type Response interface {
Body
}
type Body interface {
Close()
}
|
6e486cfc61def309554ac0e4c197e2ca0490c0e4 | 47a4384103dd02a78c08893475fc448b5a552c06 | goodwin332/ffmpeg-go | /dag.go | Go | go | 5,441 | permissive | package ffmpeg_go
import (
"errors"
)
// Node in a directed-acyclic graph (DAG).
//
// Edges:
// DagNodes are connected by edges. An edge connects two nodes with a label for each side:
// - ``upstream_node``: upstream/parent node
// - ``upstream_label``: label on the outgoing side of the upstream node
// - ``downst... |
3f326b11c0147fc088134a2e0887973d492a2bbd | ad51794bf56802ce3547dadb860eb5942493d578 | cndark/adventure | /common/csv/csvparse.go | Go | go | 23,221 | no_license | package csv
import (
"encoding/json"
"fmt"
"reflect"
"strconv"
"strings"
"time"
)
type Reward struct {
ID uint32 `json:"id"`
Type uint32 `json:"type"`
Num int32 `json:"num"`
}
// type Templates struct {
// HeroTemplate struct { // 英雄模板
// HeroName csv.String `table:"hero" key:"" val:"名字"`... |
1f2ba1afebc98c3e934a5fb97a118f60efef54b3 | 1f3f57e997c673db92b9bca053435eb227fac426 | spraints/up-or-not | /upornot/http.go | Go | go | 2,817 | no_license | package main
import (
"context"
"encoding/json"
"log"
"net/http"
"net/url"
)
func buildHTTPHandler(models []*model) http.Handler {
mux := http.NewServeMux()
mux.Handle("/api/status", apiStatus(models[0]))
mux.Handle("/api/targets", apiTargets(models))
for _, m := range models {
prefix := apiTargetPrefix(m)... |
4ab9ae4f1b9acdca5a0f84ae81cb93067b296a99 | b6b6063377a6966be7acea30209fcd3ec24249da | hzl-xx/data_structures | /Stack/coord.go | Go | go | 227 | no_license | package Stack
import "fmt"
type Coord struct {
x, y int
}
func (c *Coord) InitCoort(x, y int) {
c.x = x
c.y = y
}
func (c *Coord) PrintCoort() {
fmt.Println("("+fmt.Sprintf("%d", c.x)+", "+fmt.Sprintf("%d", c.y)+")")
}
|
b39367a03fff8a72283c6cea1be86e9cef27e616 | 4054e3a9a6ecb10a3a8095e1abbce1254eb6e37c | xiaogouguohe/mit-6.824 | /src/main/mrsequential.go | Go | go | 2,573 | no_license | package main
//
// simple sequential MapReduce.
//
// go run mrsequential.go wc.so pg*.txt
//
import "fmt"
//import "../mr"
import "6.824_new/src/mr"
import "plugin"
import "os"
import "log"
import "io/ioutil"
import "sort"
// for sorting by key.
type ByKey []mr.KeyValue
// for sorting by key.
func (a ByKey) Len() ... |
c6e5df7000779d55037a62692212467713b697bf | 0d0e0de61dc67afd9990613e8c08b0e09f2818c8 | kokizzu/lxd | /lxd/device/pci/pci_test.go | Go | go | 511 | permissive | package pci_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/lxc/lxd/lxd/device/pci"
)
func TestNormaliseAddress(t *testing.T) {
cases := map[string]string{
"": "",
"0000:00:00.0": "0000:00:00.0",
"1000:00:00.0": "1000:00:00.0",
"00:00.0": "0000:00:00.0",
"0000... |
7bb05bf118cd4565f55dd87260de28fc93ff1ee7 | 7c7deb4b14ae8b0f634a8c06dad84972da0e7dd4 | kubernetes-sigs/cluster-api | /exp/ipam/api/v1alpha1/doc.go | Go | go | 671 | permissive | /*
Copyright 2022 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, ... |
02eefb1f7f7af74f6f7eb30c2322b17a3bf38223 | 7989005c418fb62e22b1858068fcb8df639ab857 | daiguadaidai/tidb | /types/time_test.go | Go | go | 46,354 | permissive | // Copyright 2015 PingCAP, 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... |
59c48f351d460c5c76da01cd4192bb82ddd1824f | c0b7b4b71a8ef8a638d728fc1bb23e461bb283eb | clipperrrrrrr/synapse | /net/discovery.go | Go | go | 1,489 | permissive | package net
import (
"context"
"time"
host "github.com/libp2p/go-libp2p-host"
ps "github.com/libp2p/go-libp2p-peerstore"
mdns "github.com/libp2p/go-libp2p/p2p/discovery"
logger "github.com/sirupsen/logrus"
)
// Discovery interval for multicast DNS querying.
var discoveryInterval = 1 * time.Minute
// mDNSTag i... |
03f3824be37cd6c61cb7e492e6102cd5f23ece36 | b916b69e4b5206da7231f1d4d884e99cc8e0ec9c | JakeHumphries/gymshark-hacker-news | /cmd/publisher/main.go | Go | go | 1,137 | no_license | package main
import (
"context"
"time"
"github.com/JakeHumphries/gymshark-hacker-news/internal/hackernews"
"github.com/JakeHumphries/gymshark-hacker-news/internal/models"
"github.com/JakeHumphries/gymshark-hacker-news/internal/publisher"
"github.com/JakeHumphries/gymshark-hacker-news/internal/queue"
"github.co... |
3d431e3dcb08407866d2b44b55f4b8a0682d14f9 | 34b1ab741260b250c3a1336d8843e45bdc26c291 | maissssss/circleci-cli | /cmd/runner/runner.go | Go | go | 688 | permissive | package runner
import (
"github.com/spf13/cobra"
"github.com/CircleCI-Public/circleci-cli/api/rest"
"github.com/CircleCI-Public/circleci-cli/api/runner"
"github.com/CircleCI-Public/circleci-cli/settings"
)
func NewCommand(config *settings.Config, preRunE validator) *cobra.Command {
r := runner.New(rest.New(conf... |
1624397f8b2a5d149e885a57d7e999d341bbf718 | 1b9d902946aeae1428d8946377faf956afa7c5e9 | pmapcat/leetcode | /basic_calculator_test.go | Go | go | 1,392 | no_license | // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @ Copyright (c) Michael Leahcim @
// @ You can find additional information regarding licensing of this work in LICENSE.md @
// @ You must not remove this notice, or any other... |
a61f4e9116ac2c0c5fabb8a1f1b11e806e9b5cf8 | 7de48c15389638bd3480dc7988fa8c151f988272 | jamesv84/hl3 | /chaincode_finished/chaincode_finished.go | Go | go | 7,121 | no_license | /*
Copyright IBM Corp 2016 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 writ... |
24d74fe6b66b820c2fa199e82e50591dab97ce6e | 32058e6cc2d281b43d3a09a58a2de0f4fd9acb0f | mayli/grafana | /pkg/components/imguploader/imguploader.go | Go | go | 2,520 | permissive | package imguploader
import (
"context"
"fmt"
"regexp"
"github.com/grafana/grafana/pkg/setting"
)
type ImageUploader interface {
Upload(ctx context.Context, path string) (string, error)
}
type NopImageUploader struct {
}
func (NopImageUploader) Upload(ctx context.Context, path string) (string, error) {
return... |
8a7b5827e1e197e2eaafca3506140c7d8b0c67ac | 0dd2d040d91128f3b2a5cb434af4994950ad46e1 | shiboyan/kubernetes-docs | /pkg/proxy/userspace/proxysocket.go | Go | go | 9,258 | permissive | /*
Copyright 2015 The Kubernetes 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 ag... |
ea328487c1543ce27169795b6a8abf7fcffee212 | ec4176b21e429728a424e4e3af52cc8887f3e94c | gothicrush/crush-scheduler | /_prepare/_etcd/_connect/main.go | Go | go | 414 | no_license | package _connect
import (
"go.etcd.io/etcd/clientv3"
"log"
"time"
)
func main() {
// etcd 客户端连接配置
var etcdConfig clientv3.Config = clientv3.Config{
Endpoints: []string{"127.0.0.1:2379"},
DialTimeout: 5 * time.Second,
}
// 建立连接
etcdClient, err := clientv3.New(etcdConfig)
if err != nil {
log.Println... |
4c94d40dfa62f8d13183ae08865c03eddb927674 | 40d6c09700fdead9332de0eede1371c3cb5d3c5d | mariash/copilot | /vendor/istio.io/istio/pilot/pkg/networking/plugin/authz/rbac.go | Go | go | 30,723 | permissive | // Copyright 2018 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 i... |
514cd3f7707065be53c5d0a3bc5549b2598e9f0c | c199059b9f968cb87dc7af8834f141e2e6ef5c48 | dunefro/data-structures-algorithms | /golang/section_2/chapter_3/queue/circular_queue/insert.go | Go | go | 446 | no_license | package main
import "fmt"
func insertNode(queue *[]int, front, rear, value int) (*[]int, int, int, error) {
var err error
if front == -1 {
front = 0
rear = 0
} else if (front == 0 && rear == MAX-1) || (rear == front-1) {
err = fmt.Errorf("QueueOverflow: Queue is full.")
// return queue, front, rear,
} els... |
e3590c2d207e638353303617093a854caa98263c | 4a1e4742c8fa579ba1c041c74cd583ba86076d21 | wanziforever/pg_parallel_data_load | /src/main/utils.go | Go | go | 238 | no_license | package main
func sizeConvert(l int64) (int64, string) {
var sizes []string = []string{ "B", "KB", "MB", "GB", "TB" };
var order = 0;
for l >= 1024 && order < len(sizes) - 1 {
order++;
l = l/1024;
}
return l, sizes[order]
}
|
e9e273392c099471bd4fb0d627b8401c80bd58a1 | 7d893709d4bc27ec15d906a55ac9a70871f110c3 | ahreji5751/golang-skeleton | /app/models/user.go | Go | go | 633 | no_license | package models
import "time"
type User struct {
ID uint64 `gorm:"AUTO_INCREMENT;primary_key"`
Email string `gorm:"type:varchar(100);unique_index;not null" json:"email" create:"nonzero,min=3,max=40,regexp=^[a-z0-9._+]+@[a-z0-9.]+[.][a-z]+$" signin:"nonzero"`
Name string `gorm... |
8a29e7c7c4cb9a61d7c0d8c7b0139fed16cb5023 | 5fa415fb543e49b55c9c26a676f63dc14a07c0b3 | nocaway/yugabyte-db | /managed/yba-installer/cmd/clean.go | Go | go | 1,467 | permissive | package cmd
import (
"log"
"github.com/spf13/cobra"
"github.com/yugabyte/yugabyte-db/managed/yba-installer/common"
)
func cleanCmd() *cobra.Command {
var removeData bool
clean := &cobra.Command{
Use: "clean [--all]",
Short: "The clean command uninstalls your YugabyteDB Anywhere instance.",
Long: `
... |
b08ffeac673836ac1814baf781a4637a7b428024 | 4489410c033dab3b94ddab50fc18544e9499ffcb | dothanthitiendiettiende/poseidon | /pkg/commands/shell/shell.go | Go | go | 586 | permissive | package shell
import (
"github.com/xorrior/apfellgo/pkg/utils/structs"
)
//Shell - Interface for running shell commands
type Shell interface {
Command() string
Response() []byte
}
//Run - Function that executes the shell command
func Run(task structs.Task, threadChannel chan<- structs.ThreadMsg) {
tMsg := struct... |
d29f45b84d8ebd46de87455791fe72c143e9b519 | 282121fac74560b22efeb908cac4fc93b963e68f | sshen/etcd | /rafthttp/transport.go | Go | go | 9,228 | permissive | // Copyright 2015 CoreOS, 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... |
dcbea271bf8a405c42c89a3ff936225c94ad5f93 | 0d2039f5987e3bfb789f8867a3ab6c91473339b4 | kelub/DSAnote | /Thinking/BackTracking/backtracking_test.go | Go | go | 688 | no_license | package BackTracking
import (
"fmt"
"testing"
)
func TestQueens(t *testing.T) {
num := 4
q := Queens{
result: make([]int, num, num),
num: num,
results: make([][]int, 0),
}
q.queens(0)
fmt.Println(q.results)
}
func TestBackPack(t *testing.T) {
p := &BackPack{
items: []int{1, 2, 4, 8, 16, 32},
... |
edea7a546ba1c2cf29bccb1bb2be9d0fa0b0a79b | 9a48f912c790353f458bef3171434245a20bc972 | starclusterteam/go-starbox | /metrics/auto/init.go | Go | go | 1,607 | no_license | package autometrics
import (
"net/http"
"os"
"strconv"
"github.com/pkg/errors"
"github.com/starclusterteam/go-starbox/config"
"github.com/starclusterteam/go-starbox/constants/envvar"
"github.com/starclusterteam/go-starbox/log"
"github.com/starclusterteam/go-starbox/metrics"
)
const (
prometheusPortEnv = "P... |
31941764e35eac4dc247dd827a08dd4e79a9a1f5 | 30e9ee2c9efa730f4b2c178f15714ededd06a9a1 | cebartling/project-euler-solutions | /problem-008/go/src/project-euler-008/project-euler-008.go | Go | go | 1,818 | no_license | package main
import "fmt"
import "regexp"
import "strconv"
func main() {
data := `73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
668966489504452445231617318... |
68745d4bcc759a4bce49ce10adaa3e01aa7b9718 | c594e33cd3a28be915a26ded44ec5718f57326ea | matlockx/dd-zipkin-proxy | /correct_test.go | Go | go | 3,852 | permissive | package zipkinproxy
import (
"github.com/flachnetz/dd-zipkin-proxy/proxy"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"
"math/rand"
"testing"
"time"
)
func TestTree(t *testing.T) {
RegisterTestingT(t)
firstSpan := proxy.Span{Id: 1}
secondSpan := proxy.Span{Id: 2, Parent: firstSpan.Id}
tree := ne... |
3c5ab6bfd65efc4e5e9759625f185011486ce141 | c53516ed4fe86ddbdc20ab661aa6c4de66bac307 | tom2jack/titea | /pkg/redis/read.go | Go | go | 4,342 | permissive | package redis
import (
"bufio"
"errors"
"fmt"
"io"
)
var (
okReply interface{} = "OK"
pongReply interface{} = "PONG"
)
// Reader represent a reader for RESP or telnet commands.
type Reader struct {
rd *bufio.Reader
buf []byte
start int
end int
data []byte
}
// NewReader returns a command reader... |
7148a5b38c0829a2e3c40ad9588d4a6638dd86dc | 95014c84d5485b56ccce6c644941c2d8d42b1551 | kubeedge/kubeedge | /vendor/k8s.io/kubernetes/test/e2e/storage/testsuites/volume_expand.go | Go | go | 17,344 | 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 writing, ... |
fcdacd0a90f84b3897266d7778df90fbedea8bf5 | e4872f8ed39b27943439e2c89f9d939b66a046cc | johnmcollier/kabanero-operator | /pkg/controller/collection/directive_processor_test.go | Go | go | 1,964 | permissive | package collection
import (
"fmt"
"strings"
"testing"
)
func TestDirectiveProcessor(t *testing.T) {
tests := []struct {
name string
provided []byte
expected []byte
}{{
name: "Substitute CollectionName",
provided: []byte(`
#Kabanero! on activate substitute CollectionName for text '${collection-name}... |
f99158d7edee23d28800355207f564d3ccc4be47 | fbe3d67840a4d2049c7192ac7847a212121a598d | tily/sdk-go | /awstesting/integration/smoke/redshift/client.go | Go | go | 363 | permissive | // +build integration
//Package redshift provides gucumber integration tests support.
package redshift
import (
"github.com/tily/sdk-go/awstesting/integration/smoke"
"github.com/tily/sdk-go/service/redshift"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@redshift", func() {
gucumber.World["cl... |
f6e663ce676422df365081ec03540f0438b68961 | b47001647d39c11338763389260d2baa990fa977 | herohero96/shareBox | /go语言/v2.0课程/资料模块4:复合类型/14.结构体/mydemo/1.结构体创建与初始化.go | Go | go | 358 | no_license | package main
import "fmt"
func main() {
type Student struct {
id int
name string
age int
addr string
}
var s Student = Student{101, "张三", 18, "北京"}
fmt.Println(s)
var s1 Student = Student{202, "李四", 22, "深圳"}
var s2 Student = Student{id: 12, name: "王五"}
s2.name = "二妮子"
fmt.Println(s2)
fmt.Prin... |
d4cf40cb994abfc3a7b9b739431f76ca71f78ff9 | 3a72c445cdc37d2ed2e60636827f9f8c217bb30b | CypherpunkSamurai/keto | /cmd/namespace/migrate_down.go | Go | go | 614 | permissive | package namespace
import (
"github.com/ory/keto/cmd/migrate"
"github.com/spf13/cobra"
)
func NewMigrateDownCmd() *cobra.Command {
cmd := &cobra.Command{
Deprecated: "This step is not necessary anymore, see https://github.com/ory/keto/pull/638",
Use: "down <namespace-name> <steps>",
Short: "Migra... |
ea1805f196c0cd3f356b5a8b3c5b49906ee314a8 | 41e108dc7b71f6d8a24f595aca3e3ba216daed48 | EvanXzj/go-by-example-coding | /channels-non-blocking.go | Go | go | 1,341 | no_license | package main
import (
"fmt"
)
// Basic sends and receives on channels are blocking
// However, we can use select with a default clause
// to implement non-blocking sends, receives, and even non-blocking multi-way selects.
// NonBlockingChannels illustrate .
func NonBlockingChannels() {
messages := make(chan string... |
0502281912054d0e9a46834af74f31eb5d42dfe5 | 5d76b6e592657424c517e84ab2c8b5971e23eeaa | rodfrancisco/istio | /pilot/pkg/config/kube/gateway/deploymentcontroller_test.go | Go | go | 4,155 | 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... |
04a090179be31fb5ba6df78ce83c4c4b966125c7 | fd523d852ca99a5763128d4e983e3898d135e4d3 | github3234/fabric-2.1-gm | /internal/peer/lifecycle/chaincode/chaincode.go | Go | go | 6,442 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package chaincode
import (
"fmt"
"time"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/core/chaincode/platforms"
"github.com/hyperledger/fabric/internal/peer/common"
"github.com/paul-lee-attorney... |
8aee9809a07f209fa02462626517f13a0db0bcaa | 48f10943d8adac7ab29218c54ee2ddafd36b4b88 | shanhashcah/diamnetaurora1.11.0 | /clients/auroraclient/trade_request.go | Go | go | 2,917 | permissive | package auroraclient
import (
"context"
"encoding/json"
"fmt"
"net/url"
hProtocol "github.com/diamnet/go/protocols/aurora"
"github.com/diamnet/go/support/errors"
)
// BuildURL creates the endpoint to be queried based on the data in the TradeRequest struct.
// If no data is set, it defaults to the build the URL... |
75f44de2149ba7bfb0fec37053b3cee3b72c3bbd | a434e71d0b7f67a8ba2720e0eef7b0de3a002ad6 | zeusyu2013/ngengine | /src/ngengine/share/define.go | Go | go | 691 | permissive | package share
type SessionId uint64
type ServiceId uint16
const (
MAX_BUF_LEN = 1024 * 16 // 消息缓冲区大小16k
SID_MAX = 0xFFFF // service id 最大值
SESSION_MAX = 0x7FFFFFFFFFFF // session最大值
)
// mailbox类型定义
const (
MB_FLAG_APP = iota // app
MB_FLAG_CLIENT // client
)
const (
ST_ADMIN = 1 +... |
ad8bc3506d5d86e424cf17b814b5a1b3fdfee056 | 8446c6eb489d46b51a0e0b7e20726b88fdca3df1 | petertseng/p2 | /pkg/store/consul/statusstore/rcstatus/status.go | Go | go | 893 | permissive | package rcstatus
import (
"encoding/json"
"github.com/square/p2/pkg/store/consul/statusstore"
"github.com/square/p2/pkg/types"
"github.com/square/p2/pkg/util"
)
type Status struct {
NodeTransfer *NodeTransfer `json:"node_transfer"`
}
type NodeTransfer struct {
OldNode types.NodeName `json:"old_node"`
NewNode... |
7b90901f64d0296ad6e02625542427e2995c2a03 | 8c5949eb00e93709997c6c4e6fb65293a8b2e326 | digikarya/kendaraan | /app/model/dm_checkListKendaraan.go | Go | go | 9,523 | no_license | package model
import (
"errors"
"github.com/digikarya/helper"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"log"
"net/http"
"strconv"
)
type CheckListKendaraanPayloadMany struct{
CheckListID uint `gorm:"column:check_list_id; PRIMARY_KEY" json:"-"`
HashID string `json:"id" validate:""`
JenisKendaraan strin... |
d8d818946e6406c37a622d4c023986d694d1ddbf | a4ec6b8d4b182b42ae6a4ae4f32ab6b29381e651 | sserf/go-admin | /template/types/types.go | Go | go | 24,948 | permissive | // Copyright 2019 GoAdmin Core Team. All rights reserved.
// Use of this source code is governed by a Apache-2.0 style
// license that can be found in the LICENSE file.
package types
import (
"encoding/json"
"github.com/GoAdminGroup/go-admin/modules/config"
"github.com/GoAdminGroup/go-admin/modules/db"
"github.co... |
641ab1d5c99447b1697f912bb1c2d5c9d0fe6474 | 0250e40fcbaa353daa752b2371fe4971ac35e00a | colangiuli/kanban | /modules/auth/auth.go | Go | go | 841 | permissive | package auth
import (
"errors"
"github.com/Unknwon/macaron"
"github.com/dgrijalva/jwt-go"
"github.com/spf13/viper"
"gitlab.com/kanban/kanban/models"
)
// SignedInUser returns models.User instance if user exists
func SignedInUser(ctx *macaron.Context) (*models.User, error) {
h := ctx.Req.Header.Get("X-KB-Access-... |
4cd8f74b9dcaeb37f1fa7ee8ec2bd302453e556b | 0b8bd7fe22274b9539455df1f8d7c3031e9f957f | OKNoah/kube-arangodb | /deps/github.com/arangodb/go-velocypack/encoder.go | Go | go | 17,417 | permissive | //
// DISCLAIMER
//
// Copyright 2017 ArangoDB GmbH, Cologne, Germany
//
// 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 require... |
eb18d27e5bfbd74069e563e129c654e8ccf079c4 | 96fd5f2184829e260f1e9fb6effa7c8c2c6e3293 | raginjason/aoc2019 | /main.go | Go | go | 1,191 | no_license | package main
import (
"fmt"
"github.com/raginjason/aoc2019/day2"
"github.com/raginjason/aoc2019/day5"
"github.com/raginjason/aoc2019/day7"
"github.com/raginjason/aoc2019/day9"
)
func main() {
day1 := day1()
fmt.Printf("Day 1 answer: %d\n", day1)
day1pt2 := day1pt2()
fmt.Printf("Day 1 part 2 answer: %d\n", da... |
e0edde541f56e742c811c60dc738d6ca4137749f | e098516af019ff3aa6b3f6dbbd189f617e6ec1f9 | isgasho/go-admin | /connections/mysql/mysql.go | Go | go | 9,527 | permissive | package mysql
import (
"context"
"database/sql"
_ "github.com/go-sql-driver/mysql"
"goAdmin/config"
)
type SqlTxStruct struct {
Tx *sql.Tx
}
var (
sqlDBmap map[string]*sql.DB
SqlDB *sql.DB
)
// 只会执行一次在执行程序启动的时候
func InitDB(username string, password string, port string, ip string, databaseName string) {
... |
22e678ec399e2928c8a55a5fdb9dbbca8383eb60 | 5a06f438be8fc2bef72ed9674cf70649982f8726 | Assadbintahir/go-with-tdd | /HelloWorld/helloworld.go | Go | go | 609 | no_license | package helloworld
import "fmt"
const spanish = "Spanish"
const french = "French"
const frenchHelloPrefix = "Bonjour "
const spanishHelloPrefix = "Hola "
const englishHelloPrefix string = "Hello "
func SayGreeting() {
fmt.Println(Hello("Asad", "English"))
}
func Hello(name string, language string) string {
if nam... |
a5950802294c2dfe03d33f24698b4bddc29785d8 | db842696eeafd005706de75676e15dfec1e84597 | ValarDragon/cosmos-sdk | /types/rest/rest_test.go | Go | go | 13,069 | permissive | // Package rest provides HTTP types and primitives for REST
// requests validation and responses handling.
package rest
import (
"errors"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"sort"
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
"github.com/te... |
6fad576127b3e1caace01752f70b556663877e21 | c8919486c190e0458790fef8948d038e6bd35171 | geoffroy-perso/slack-logger-medium | /setup_test.go | Go | go | 1,035 | no_license | package slackTracker
import (
"fmt"
"os"
"os/exec"
"testing"
"time"
)
func TestTracker(t *testing.T) {
webhook := os.Getenv("WEBHOOK")
application := os.Getenv("APPLICATION")
defer func() {
if err := recover(); err != nil {
}
}()
tracker := Tracker{
WebHook: webhook,
Application: application,
}
... |
dbcdca5574e6410d809715e1ae1833b92f99cdf8 | 927fb5a550afd0a1e1bd022391424fd4ec497c4a | engwarrior/cosmos-sdk | /x/auth/alias.go | Go | go | 4,667 | permissive | package auth
import (
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
// DONTCOVER
// nolint
const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey
FeeCollectorName ... |
2f32761311920eab79cd0fcc67125cd63227bf07 | 1c89e8fba8671af458b3ed20dc17cb627c8b1a37 | lin168/picBedClient | /main.go | Go | go | 2,143 | no_license | package main
import (
"context"
"fmt"
"github.com/atotto/clipboard"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"log"
"os"
"path/filepath"
"strings"
"time"
)
/*
指定一个图片文件作为参数,上传至minio服务器上。
允许图片的格式: .jpg、 .png .jpeg
*/
//var target = "192.168.1.104"
var target = "pic.ll... |
2da230f052cae614688f324013d6b129da040e4b | 6bb0316ceb0463f7c49bfe8359065e4f43160162 | apaxa-go/helper | /testingh/iotesth/writer_test.go | Go | go | 1,317 | permissive | package iotesth
import (
"bytes"
"errors"
"io"
"testing"
)
func TestErrorWriter(t *testing.T) {
data := make([]byte, 1024)
cn := 0
ew := ErrorWriter(nil, int64(cn), nil)
if n, err := ew.Write(data); n != cn || err != io.ErrShortWrite {
t.Errorf("expect %v %v, got %v %v", cn, io.ErrShortWrite, n, err)
}
... |
8eee6a70ecde11f3d86d4f44224225ad3752df09 | aafbfdcbe2d7bfac2af87dc1e8e86b892e82fc06 | sugerpocket/go-graphql-todo | /structs/todo.go | Go | go | 244 | permissive | package structs
import (
"time"
)
/*Todo schema define*/
type Todo struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.