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 |
|---|---|---|---|---|---|---|---|---|
3f2a9b7bdbe614b11e354296ea7b2bd59fe09d24 | ca9d5b388d00dc5d48c36ff719bb18c1eeda913a | Logiraptor/vm | /codegen/codegen.go | Go | go | 2,978 | no_license | package codegen
import (
"reflect"
"unsafe"
"vm/core"
"vm/debug"
)
//go:generate dsl_generator -type Instruction
type Instruction interface {
isCodeGenPassInstruction()
}
type ArithmeticInstruction struct {
Instruction
OpCode core.OpCode
Destination core.Register
Operand1 core.Register
Operand2 ... |
673e9db69b38281f1014233bf2b887deae52be51 | c07fcb62d178e64eaee41a7eb768cd70d16fcbc1 | kubesphere/kubesphere | /pkg/simple/client/network/ippool/ipam/ipam_test.go | Go | go | 3,939 | permissive | /*
Copyright 2020 KubeSphere Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
3267d78b1a8265d6b5ea7a95d5d9f64e6219c475 | 69d8b68480a658345db614a0cc7d9e67717602c6 | hatlonely/notebook | /golang/code/prometheus-client_golang/promauto.go | Go | go | 4,389 | no_license | package main
import (
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
// promauto 中默认会有 GoCollector 的指标,如果不需要,可以用如下方式替换掉 Registry
registry := prometheus.NewReg... |
d9649a5579a210c8111e7c9aa367d2b16d0a7d18 | 2e90bd3845ef9c5a3a7a73adca6b40fb10768aea | dealako/aws-lambda-go-api-proxy | /sample/main.go | Go | go | 1,494 | permissive | package main
import (
"context"
log "github.com/sirupsen/logrus"
"net/http"
"strconv"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
ginadapter "github.com/dealako/aws-lambda-go-api-proxy/gin"
"github.com/gin-gonic/gin"
)
var ginLambda *ginadapter.GinLambda
// Handler is the mai... |
7ff7f82a063be9bf3b2f3370e8596058bd706abe | 98bd76912bef02577900a6639d5918f67dd6ab96 | MilosSimic/actor | /main.go | Go | go | 1,849 | permissive | package main
import (
"fmt"
"time"
)
type MyMessage struct{}
func (m MyMessage) Name() string {
return "MyMessage"
}
func (m MyMessage) Params() map[string][]byte {
return nil
}
type ChangeState struct{}
func (m ChangeState) Name() string {
return "MyMessage"
}
func (m ChangeState) Params() map[string][]byt... |
8a2c2bbd27528112aa99d7771a60befa435e6e04 | d45a6f44e6fcb873b0d42e1f89c8dc73874e323b | emerson-argueta/postgres-react-golang-template | /backend/modules/identity/infrastructure/persistence/user.go | Go | go | 3,193 | no_license | package persistence
import (
"context"
"database/sql"
"emersonargueta/m/v1/modules/identity/domain/user"
"emersonargueta/m/v1/modules/identity/repository"
"emersonargueta/m/v1/shared/infrastructure/database"
)
var _ repository.UserRepo = &User{}
// User represents a service for managing a user.
type User struc... |
25ad397ba69f1e586788637f51add0056d9ee22f | 3a2a7a19d7561a76e4c4513acc16acd4dc6de481 | codelieche/goAction | /tutorial/base/demo/channel/done/done.go | Go | go | 768 | permissive | package main
import (
"fmt"
)
type worker struct {
in chan int
done chan bool
}
func doWorker(id int, c chan int, done chan bool) {
for n := range c {
fmt.Printf("Worker %d received %c\n", id, n)
done <- true
}
}
func createWorker(id int) worker {
w := worker{
in: make(chan int),
done: make(chan ... |
23accd37469ddcff580842de86978de1e0ac4a3c | 26b195f0299f1d94c0ad9462b6bc0b9f80bf9d1a | zeroviral/go_test_PuTTY | /controllers/healthcheck.go | Go | go | 647 | no_license | package controllers
import (
"encoding/json"
"go_test_PuTTY/config"
"net/http"
)
type HealthCheckResponse struct {
Name string `json:"name"`
Version float64 `json:"version"`
Commit string `json:"commit"`
Host string `json:"host"`
}
// HealthCheck Endpoint
func HealthCheck(w http.ResponseWriter, r *h... |
4517c9ba88047f0c9eeddad266bdc3855cf7bccd | 3f08e9019c2a4c1eb3f585aeb1b085732defadb5 | beike2020/source | /Linuxg/goc_rout/searchGithub_expl.go | Go | go | 3,521 | no_license | package github
//$ go run searchGithub_expl repo:golang/go is:open json decoder
import (
"encoding/json"
"fmt"
"html/template"
"log"
"net/http"
"net/url"
"os"
"strings"
"text/template"
"time"
)
const IssuesURL = "https://api.github.com/search/issues"
const templ = `{{.TotalCount}} issues:
{{range .Items}}-... |
2c5cb669c8085a914457ae9ff438649b58621ef9 | 61a48569de7e58229bbb92acc5122e11b4aa1927 | wellington/wellington | /handlers/handlers.go | Go | go | 6,990 | permissive | package handlers
import (
"bytes"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
"path/filepath"
"reflect"
"strings"
"golang.org/x/net/context"
libsass "github.com/wellington/go-libsass"
"github.com/wellington/go-libsass/libs"
sw "github.com/wellington/spritewell"
"github.com/wellington/wellington/payl... |
8ff4b77bce64e34c42a366982e9f79a783342160 | 686c0f9e41750785e6483a3a848485cd347ca22a | santegoeds/poloniex | /channeltickerdata_test.go | Go | go | 1,375 | permissive | package poloniex_test
import (
"context"
"os"
"testing"
"github.com/kr/pretty"
"github.com/santegoeds/poloniex"
"github.com/santegoeds/poloniex/channel"
"github.com/santegoeds/poloniex/event"
"github.com/santegoeds/poloniex/message"
"github.com/stretchr/testify/require"
)
func TestTickerData(t *testing.T) ... |
eb3c5964ba1e9ca953c26a7cb1a0b2f9c98c5d20 | 09440f764f43f50555b036f85e79150231450611 | dkapanidis/app-starters | /golang-gin-rest/pkg/store/healthz.go | Go | go | 666 | no_license | package store
import "github.com/dkapanidis/app-starters/golang-gin-rest/pkg/models"
// GitBranch The branch used to build the binary
var GitBranch string
// GitCommit The commit ID used to build the binary
var GitCommit string
// GitSummary The Git Summary
var GitSummary string
// GitState The Git State (dirty or... |
e2c7ddddca790410c7d5cbdec956539632793e55 | 8a28ea0ed8475da114daf5eb7dc49bd5b390cf6c | szunami/smartystreets-go-sdk | /internal/sdk/custom_header_client_test.go | Go | go | 1,419 | permissive | package sdk
import (
"errors"
"net/http"
"testing"
"github.com/smartystreets/assertions/should"
"github.com/smartystreets/gunit"
)
func TestCustomHeadersClientFixture(t *testing.T) {
gunit.Run(new(CustomHeadersClientFixture), t)
}
type CustomHeadersClientFixture struct {
*gunit.Fixture
headers http.Header... |
0b33193d379a241ea39655686251cb82b255c512 | d47859fbbce226ffc35b266a147cb471f4088786 | edgarlanting/cli | /internal/cmd/database/delete.go | Go | go | 2,455 | permissive | package database
import (
"context"
"errors"
"fmt"
"os"
"github.com/planetscale/cli/internal/cmdutil"
"github.com/planetscale/cli/internal/printer"
"github.com/planetscale/planetscale-go/planetscale"
"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/spf13/cobra"
)
... |
4406df840480f9f777e556be183ecd5c58051842 | 11bcd2bb81f00ee04abba8c2b8fd608b4255693a | ienugr/siris | /sessions/sessiondb/redis/service/service.go | Go | go | 6,620 | permissive | // Copyright 2017 Gerasimos Maropoulos. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package service
import (
"time"
"github.com/garyburd/redigo/redis"
"github.com/go-siris/siris/core/errors"
)
var (
// ErrRedisClosed an error with ... |
81d0423161e9feb936d4e2f7c3a2ccdb07bbf579 | cafe7d9809a115374db01802e30eb993ac1c3cc0 | benjames-171/defold-games | /Alpha Squirrel/game/effects/effect.go | Go | go | 372 | permissive | components {
id: "script"
component: "/game/effects/effect.script"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
components {
id: "pickup"
component: "/game/effects/pickup.particlefx"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation ... |
726f21872f7afd9a0a05506e9ead4fa140276dfd | 6a75a67155349b68e94d936ac80a4b9adc74fd2c | MrGru/GruGo | /cookbook/distributed_systems/concensus/fsm.go | Go | go | 393 | no_license | package concensus
import (
"io"
"github.com/hashicorp/raft"
)
type FSM struct {
state state
}
func NewFSM() *FSM {
return &FSM{state: first}
}
func (f *FSM) Apply(r *raft.Log) interface{} {
f.state.Transition(state(r.Data))
return string(f.state)
}
func (f *FSM) Snapshot() (raft.FSMSnapshot, error) {
retur... |
dcb4000d34d9e11c8f7ee94d9eb86fcf386aa3de | 474af1f0d472aa2872349b666456c329808a5c1a | GoogleCloudPlatform/k8s-config-connector | /third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/resource_apigee_nat_address_generated_test.go | Go | go | 5,229 | permissive | // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file ... |
66bb0d18ea138c21d8bb17e552fddf90a5212def | aebe9c984d387a4ccba52d928b244bfaaca4cd0f | trsmith2/google-api-go-client | /billingbudgets/v1beta1/billingbudgets-gen.go | Go | go | 63,005 | permissive | // Copyright 2021 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package billingbudgets provides access to the Cloud Billing Budget API.
//
// For product documentation, see: https://cloud.google.com/billing/d... |
b248ca5a3ba7efb6176adb45c92c68c0191198cd | 060599e3e1d4c2359c01636e5295556e58a4ed93 | eranchetz/kuberbs | /testing-app/bad/fluentd.go | Go | go | 1,398 | permissive | //frm https://github.com/joonix/log/blob/master/fluentd.go
package main
import (
"encoding/json"
"fmt"
"time"
"github.com/sirupsen/logrus"
)
// FluentdFormatter is similar to logrus.JSONFormatter but with log level that are recongnized
// by kubernetes fluentd.
type FluentdFormatter struct {
TimestampFormat str... |
a1dfd30bb3e0832b334fba832e62e7a180cee8e9 | 0c28ed230a6973570a446d912a138f0c6248922f | ventureum/BigBang | /test/lambda/TCR/update_batch_available_delegate_votes/update_batch_available_delegate_votes.go | Go | go | 1,380 | no_license | package update_batch_available_delegate_votes_test
import (
"BigBang/cmd/lambda/TCR/update_batch_available_delegate_votes/config"
"BigBang/test/constants"
"github.com/stretchr/testify/assert"
"testing"
)
func TestHandler(t *testing.T) {
tests := []struct {
request lambda_update_batch_available_delegate_votes_... |
c6816a189ab412f4dec2cbed2314b6196e251470 | da2397d27e36b2f7eaab94a119de6c68dfbb115e | suntoe/gauge | /gauge/protoConverters_test.go | Go | go | 7,650 | permissive | /*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/
package gauge
import (
"github.c... |
c19068c134ae29668ef6e3303b881feafd1157fb | 7e0aa53d500e0769d3305955a78c26e01fbbc8d4 | lynkdb/iomix | /skv/fo.go | Go | go | 3,045 | no_license | // Copyright 2015 Eryx <evorui аt gmаil dοt cοm>, 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 re... |
200ad1708f49c86f9d8e3a445611a494cccfec46 | e13ee92e6c9afd8f30162144596ef3e59eb88df3 | salzr/certron | /vendor/github.com/go-acme/lego/v3/providers/dns/ns1/ns1.go | Go | go | 5,115 | permissive | // Package ns1 implements a DNS provider for solving the DNS-01 challenge using NS1 DNS.
package ns1
import (
"errors"
"fmt"
"net/http"
"strings"
"time"
"github.com/go-acme/lego/v3/challenge/dns01"
"github.com/go-acme/lego/v3/log"
"github.com/go-acme/lego/v3/platform/config/env"
"gopkg.in/ns1/ns1-go.v2/rest"... |
1142a427f399777d5e0a6c4764b1eeb441096468 | cf99c6e94f6112251141f52de1184eddb5199b6e | lovefcaaa/snk.dev-assistant | /data/snippets/github.com/distributed-vision/go-ddapp-resources/encoding/encoders.go | Go | go | 1,071 | no_license | package encoding
import (
"encoding/hex"
"errors"
"github.com/distributed-vision/go-resources/encoding/base10"
"github.com/distributed-vision/go-resources/encoding/base36"
"github.com/distributed-vision/go-resources/encoding/base58"
"github.com/distributed-vision/go-resources/encoding/base62"
"github.com/distr... |
a35dedbfae138497138981218b5cfab6a3917995 | b7a870eb80feac1c1abc73b02d7189aef70154f5 | wcharczuk/katwillmarry.com | /pkg/controller/index.go | Go | go | 486 | permissive | package controller
import (
"github.com/blend/go-sdk/logger"
"github.com/blend/go-sdk/web"
)
// Index is the root controller.
// It handles:
// - /
// - /static/** => _static/**
type Index struct {
Log *logger.Logger
}
// Register adds routes for the controller.
func (i Index) Register(app *web.App) {
app.ServeS... |
e5b61be2aaa4e3ef623c780ca08dba586c4a9250 | c868beb6162c4535b6eabdff76086f3cdce05f9c | demosdemon/super-potato | /pkg/pki/marshaled_certificate.go | Go | go | 974 | permissive | package pki
import (
"crypto/x509/pkix"
"strings"
"time"
)
type MarshaledCertificate struct {
Raw string `xml:"raw,attr"`
Subject pkix.Name
Issuer pkix.Name
SerialNumber SerialNumber
NotBefore time.Time
NotAfter time.Time
KeyUsage KeyUsage
ExtKeyUsage ExtKeyU... |
009a1f16fdae7f90cbfcbc096cd631cd7756aba6 | f6b6c71018b9d0bd3d54e42df3c25d946df2027c | biuboombiuboom/chubaofs | /cli/cmd/metapartition.go | Go | go | 12,615 | permissive | // Copyright 2018 The CubeFS 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... |
c796d649152b1cbdf293ab92397a5ecd0469bd13 | fe126747a1ff5c5b73031bf420b7b61490d5d40a | blu3fish/sourcegraph | /internal/search/backend/index_options.go | Go | go | 4,253 | permissive | package backend
import (
"bytes"
"encoding/json"
"sort"
"github.com/google/zoekt"
"github.com/sourcegraph/sourcegraph/schema"
)
// zoektIndexOptions are options which change what we index for a
// repository. Everytime a repository is indexed by zoekt this structure is
// fetched. See getIndexOptions in the zoe... |
167319d092de1d595098190fe3d275ab50a7ad0e | a63cb7e12eee702e09096141529ba66711993d7d | masakura/docker-machine-driver-lxd | /drivers/lxd/options/options_test.go | Go | go | 420 | permissive | package options
import (
"github.com/stretchr/testify/assert"
"gitlab.com/masakura/docker-machine-driver-lxd/mock_lxd"
"testing"
)
func TestNewOptions(t *testing.T) {
actual := NewOptions(mock_lxd.NewFakeOptions(map[string]interface{}{
"lxd-external-network": "enp1s0",
"lxd-remote": "remote1",
}))
... |
f456ad0a838a425b513179b36bfd9144390f7bf7 | 6d7210326b251af8172b80c47079dd07a0a31e4d | chinthirla/GoLang | /Goroutineschan/Fallthrough.go | Go | go | 357 | no_license | package main
import "fmt"
func main() {
i := 2
fmt.Println("swaitch output is:", ls(i))
}
func ls(n int) int {
switch (n) {
case 1: fmt.Printf("%d is lesser than 50\n", n)
case 2: fmt.Printf("%d is lesser than 50\n", n); fallthrough
case 3: fmt.Printf("%d is lesser than 50\n", n); fallthrough
default : fmt.Printf("... |
78ed5c048611619e2279e8f5686154612e874c27 | 5781c72c596def240f43e34e3bd8788fd15a10a5 | rhtconsulting/installer | /vendor/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/compute/parse/virtual_machine.go | Go | go | 658 | permissive | package parse
import (
"fmt"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
)
type VirtualMachineId struct {
ResourceGroup string
Name string
}
func VirtualMachineID(input string) (*VirtualMachineId, error) {
id, err := azure.ParseAzureResourceID(input)
if err != ni... |
8782572fa73cde15f187dc784250d65da7263a9a | 1ab4ff357d6e2af07eb476344ac6714280c9ebf5 | vadv/gopher-lua-libs | /goos/api.go | Go | go | 1,255 | permissive | // Package goos implements golang package os functionality for lua.
package goos
import (
"os"
lua "github.com/yuin/gopher-lua"
)
// Stat lua goos.stat(filename) returns (table, err)
func Stat(L *lua.LState) int {
filename := L.CheckString(1)
stat, err := os.Stat(filename)
if err != nil {
L.Push(lua.LNil)
L... |
e216109b8814784357e90ca3d66d446ae71bf8c6 | 692dab49419845f75f932803c7cdda674a4e10d7 | hoyeah69/bookstore_users-api | /domain/users/user_dao.go | Go | go | 5,157 | no_license | package users
import (
"fmt"
"strings"
"github.com/hoyeah69/bookstore_users-api/logger"
"github.com/hoyeah69/bookstore_users-api/datasources/mysql/users_db"
"github.com/hoyeah69/bookstore_users-api/utils/errors"
"github.com/hoyeah69/bookstore_users-api/utils/mysql_utils"
)
const (
queryInsertUser ... |
bbb6abafe9d2e1b96accd64194ba6bf9a17c48be | 46b73a279170b89c02d18804362516444f13f0e2 | vharish836/go-keyring | /keyring_windows.go | Go | go | 1,339 | permissive | package keyring
import (
"syscall"
"github.com/danieljoos/wincred"
)
type windowsKeychain struct{}
// Get gets a secret from the keyring given a service name and account.
func (k windowsKeychain) Get(service, account string) (string, error) {
cred, err := wincred.GetGenericCredential(k.credName(service, account)... |
bb48d136966d44af3dc7f658d5ff791eafcb5a57 | 555b735d9e5fb5eae09fe0921ebf86360d2ed652 | congliqiang/distributed_object_demo | /v4/data_server/main.go | Go | go | 592 | no_license | package main
import (
"github.com/congliqiang/distributed_object_demo/v4/data_server/heartbeat"
"github.com/congliqiang/distributed_object_demo/v4/data_server/locate"
"github.com/congliqiang/distributed_object_demo/v4/data_server/objects"
"github.com/congliqiang/distributed_object_demo/v4/data_server/temp"
"log"
... |
1eec32069d3aa64c6d55393e15a055f101895a5b | 035550f65cc55b14b6ca218e60f4f189c1bbbf9d | codingconcepts/datagen | /internal/pkg/runner/option.go | Go | go | 690 | permissive | package runner
import "github.com/codingconcepts/datagen/internal/pkg/random"
// Option allows the Runner to be configured by the user.
type Option func(*Runner)
// WithDateFormat sets the default date format for the Runner.
func WithDateFormat(f string) Option {
return func(r *Runner) {
r.dateFormat = f
}
}
//... |
ea5822fa1bed5274f38499e2605e6f5db4ab796e | 854dc3ac162568faa3d3742ec23c29f3e8120824 | hqtsky/kratos | /selfservice/strategy/password/registration.go | Go | go | 8,879 | permissive | package password
import (
"context"
"encoding/json"
"net/http"
"github.com/ory/x/pkgerx"
"github.com/julienschmidt/httprouter"
"github.com/markbates/pkger"
"github.com/pkg/errors"
"github.com/tidwall/sjson"
"github.com/ory/x/errorsx"
"github.com/ory/x/decoderx"
"github.com/ory/kratos/driver/config"
"g... |
328ad0a1c57ebab850021c13b744f1894bcc3b58 | ac7c77707f2110f5ada43ff30f152a2321fe116c | PumpkinSeed/adventure-of-golang | /string-builder/str/str.go | Go | go | 217 | no_license | package str
type Builder string
func (b *Builder) Write(str string) {
*b += Builder(str)
}
func (b *Builder) WriteByte(str []byte) {
*b += Builder(str)
}
func (b *Builder) String() string {
return string(*b)
}
|
200f4a652a51febb4c8e06da87480edfdf5b2a87 | f0b3338a580772a555db03113bdea8280db36221 | x-chain/fabric-sdk-go | /pkg/client/event/opts.go | Go | go | 1,044 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package event
import "github.com/x-chain/fabric-sdk-go/pkg/fab/events/deliverclient/seek"
// ClientOption describes a functional parameter for the New constructor
type ClientOption func(*Client) error
// WithBlockE... |
24dbd8b8f9b30ac47854b2ce8fc119867f7b8cd4 | 38fbe3d1ec8e70242fca22b49a88bec5fc38c7d9 | abhisheknsit/contour | /internal/dag/builder.go | Go | go | 23,980 | permissive | // Copyright © 2018 Heptio
// 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 writin... |
a03c021bbac8cfedaec02c591b4e375fbf2dae54 | 0afcb01b56749e99cc6c2e1ca613af805cca798d | antonioaorve/cli | /command/v7/start_command_test.go | Go | go | 13,036 | permissive | package v7_test
import (
"errors"
"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v7action"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant"
"code.cloudfoundry.org/cli/command/commandfakes"
"code.cloudfoundry.org/cli/command/flag"
v7 "code.cloudfoundry.org/cli/comman... |
78e5175ba67a854ab3bd29f09787421cdc8b5a51 | 852b9386c6ba345566c3158c09611599249e4e90 | lkeix/gosl | /io/texpdf.go | Go | go | 11,745 | permissive | // Copyright 2016 The Gosl Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package io
import (
"bytes"
"strings"
"time"
)
// FcnConvertNum is a function to convert number to string
type FcnConvertNum func(row int, x float64) str... |
7498a73ac2f65aa28a3527e3d44ad2ca26abf8da | 4967649ac23832e5e9dd905e8135c863bc971c9c | PrivyDG/dccn-hub | /app-dccn-api/examples_local/all.go | Go | go | 2,512 | no_license | package main
import (
"context"
"github.com/Ankr-network/dccn-hub/app-dccn-api/examples/common"
"log"
"time"
taskmgr "github.com/Ankr-network/dccn-common/protos/taskmgr/v1/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
usermgr "github.com/Ankr-network/dccn-common/protos/usermgr/v1/grpc"
c... |
3025428f66e50793af2d0b640401bcf4d9b6538b | 2dea79873409e00ecd2873504b5647667558660a | hoangpq/golisp | /ops.go | Go | go | 15,602 | permissive | package golisp
import (
"bytes"
"errors"
"fmt"
"io"
"os"
)
type Fn func(*Env, *Node) (*Node, error)
var ops map[string]Fn
func init() {
ops = make(map[string]Fn)
ops["dotimes"] = doDotimes
ops["prin1"] = doPrin1
ops["print"] = doPrint
ops["let"] = doLet
ops["setq"] = doSetq
ops["1+"] = doPlusOne
ops["1... |
835306a279238156bb278e44a8f398fcfc95b951 | c2fdc0fbda77e504cb13a30b513107f85493bf78 | learnerjiahao/mhhs | /tool/create_json/create_dispatch_depthtraverse.go | Go | go | 5,671 | no_license | package main
import (
"os"
"log"
"time"
"fmt"
"github.com/jessevdk/go-flags"
"io/ioutil"
"encoding/json"
"strconv"
"bytes"
)
type JsonStruct struct {
}
func NewJsonStruct() *JsonStruct {
return &JsonStruct{}
}
func (jst *JsonStruct) Load(filename string, v interface{}) {
//ReadFile函数会读取文件的全部内容,并将结果以[]byt... |
fa886bab9a3b19b1d0492011c70c1e1469c9dbe6 | 01ecc67395086b6a70225067934fc4fedc83b912 | Muzry/booksystem | /pkg/database/engine.go | Go | go | 490 | permissive | package database
import (
"github.com/go-xorm/xorm"
_ "github.com/mattn/go-sqlite3"
)
const DataBaseFile = "database.db"
//var Engine *xorm.Engine
func GetConnection() (*xorm.Engine, error) {
engine, err := xorm.NewEngine("sqlite3", DataBaseFile)
if err != nil {
return nil, err
}
engine.ShowSQL(true)
retur... |
d0f6b3356bb20a107d6e650cd4aaeedea9fab2e5 | 4469cde6a9a9c42e19cca162a8fb6362040947cd | schrodit/gardener-extension-provider-openstack | /vendor/github.com/gardener/gardener/pkg/utils/kubernetes/health/deployment.go | Go | go | 6,111 | permissive | // Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
098ece57c07756bee5c678c7ab331a8059f8d1de | 6a21c01729e50b374d16d3cd246669e3e5b35292 | taka-wang/psmb | /redis-history/ds_test.go | Go | go | 2,149 | permissive | package history
import (
"testing"
psmbtcp "github.com/taka-wang/psmb/tcp"
"github.com/taka-wang/psmb/viper-conf"
"github.com/takawang/sugar"
)
var (
hostName string
)
func init() {
psmbtcp.Register("History", NewDataStore)
}
func TestHistoryMap(t *testing.T) {
s := sugar.New(t)
s.Assert("`add` task to hi... |
7fa7f2029b714c42979b035006b66e5ffbeb94f2 | dc517c92d4a3580425a2d33610974fa735d83762 | cben/cluster-operator | /pkg/controller/clusterinstall/controller.go | Go | go | 17,562 | no_license | /*
Copyright 2018 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, ... |
69a58083013b6d60d2c4ef85ff987d88435ba99d | d931a23885fd1a74b65069f66c27bc25565ccbd4 | LUSHDigital/goop | /goop_test.go | Go | go | 3,320 | permissive | package goop
import (
"fmt"
"log"
"golang.org/x/net/context"
"cloud.google.com/go/pubsub"
)
// ExampleGoop_CreateClient - Example usage of the CreateClient function.
func ExampleGoop_CreateClient() {
ctx := context.Background()
// Create Pub/Sub wrapper.
g := &Goop{
Context: ctx,
Project: "project-id",
... |
7f52ef493c5a2ea4c2bd64e2d28f991850ada90f | e7fbcfe947ca9965c7817709749376531d0d3c30 | mvpzhangkai/kubernetes | /test/e2e/apps/daemon_set.go | Go | go | 31,709 | permissive | /*
Copyright 2015 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, ... |
1c2493a208d64ae04661e149fdc4a2538fba1a63 | e34df9c5a9eb5ebf04e6f68975e35e55b5dba5f2 | ti/sdk-go | /internal/internal_task_handlers_interfaces_test.go | Go | go | 6,995 | permissive | // The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Soft... |
a205ae752827eee00b7126f362dc96041442db9e | 1f60375a052470ae96fc4db820324139aa581a13 | ManchersterByTheSea/openBilibili | /go-common/app/admin/main/aegis/service/report_test.go | Go | go | 511 | no_license | package service
import (
"testing"
"github.com/smartystreets/goconvey/convey"
"go-common/app/admin/main/aegis/model"
)
func TestService_ReportTaskSubmit(t *testing.T) {
convey.Convey("ReportTaskSubmit", t, func(ctx convey.C) {
pm := &model.OptReportSubmit{
BizID: 2,
}
res, err := s.ReportTaskSubmit(cnt... |
438ae3cc08c75a995bd52147c0fd9c58c896a5b9 | 4b2b54f31724f8d53f23b91dd896d22470eca4af | zuiwanting/mall | /server/app/service/sso/internal/biz/handler.go | Go | go | 3,123 | permissive | package biz
import (
"context"
"fmt"
"time"
pb "edu/api/sso"
"edu/service/sso/internal/model"
"github.com/go-oauth2/oauth2/v4"
"github.com/go-oauth2/oauth2/v4/errors"
)
// func (s *Service) onClientInfoHandler(r *http.Request) (clientID, clientSecret string, err error) {
// clientID := r.Form.Get("client_id... |
a4073cf9edf047d411eefe51709dd2a0d1e18529 | 3e6bbaf1e7bf79396130e0098cae829f3e0f560a | JonKerridge/pnp | /brick_test.go | Go | go | 2,690 | no_license | package pnp
import (
"testing"
)
func TestNumbers(t *testing.T) {
a := make(chan int)
b := make(chan int)
c := make(chan int)
d := make(chan int)
go Prefix(c, a, 0)
go Copy2(a, b, d)
go Plus1(b, c)
var sum, check, i int = 0, 0, 0
for i < 10 {
sum = sum + i
check = check + <-d
i = i + 1
}
if check !=... |
69c5f852a808ab251ac549448e5620f3bbf5e260 | 2ef6737cebd589bd66ab404993bba0bc46bb8610 | xfong/go-opencl | /cl/types12.go | Go | go | 3,075 | no_license | // +build cl12
package cl
// #ifdef __APPLE__
// #include "OpenCL/opencl.h"
// #else
// #include "CL/opencl.h"
// #endif
import "C"
const (
ChannelDataTypeUNormInt24 ChannelDataType = C.CL_UNORM_INT24
ChannelOrderDepth ChannelOrder = C.CL_DEPTH
ChannelOrderDepthStencil ChannelOrder = C.CL_DEPTH_... |
f83fe575a46458a55b6fb9d5971aa0958062a727 | f17888335429315ad36827fa96b53c1664b6be1f | coreos/locksmith | /locksmithctl/unlock.go | Go | go | 1,535 | 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... |
71f1ab340fcfe736b35cd61b882c1c9178682c2b | 07af38f75847fa1a147bd3d0bc8163b2a5f6a33f | zhujq/free5gc-stage-3 | /lib/pfcp/pfcpType/RecoveryTimeStamp_test.go | Go | go | 218 | permissive | //go:binary-only-package
package pfcpType
import (
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestMarshalRecoveryTimeStamp(t *testing.T) {}
func TestUnmarshalRecoveryTimeStamp(t *testing.T) {}
|
38a61612afb28283124f3ba948aff46f19495937 | 4f6361286e3967a10daef033083c9b4b7914641c | AdrianOrlow/links-api | /app/utils/jwt.go | Go | go | 1,752 | permissive | package utils
import (
"errors"
"github.com/AdrianOrlow/links-api/config"
"github.com/dgrijalva/jwt-go"
"net/http"
"time"
)
type Claims struct {
Email string `json:"email"`
jwt.StandardClaims
}
type TokenResponse struct {
Token string `json:"token"`
}
func InitializeJWT(config *config.Config) {
utils.jwt.s... |
6f3abbc95adc3ced8867785790947fab8fca5cfc | 620470125c672b9a49720e9655e10bb164c74184 | haifenghuang/sqls | /internal/lsp/lsp.go | Go | go | 12,545 | permissive | package lsp
import "github.com/lighttiger2505/sqls/internal/config"
// https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#initialize
type InitializeParams struct {
ProcessID int `json:"processId,omitempty"`
RootPath string `js... |
dd9731d0642db0bd4353df99a7956e75ba8112fd | ca0611eae9575d02ccb916ceee9e5eacdddd9b47 | CptWetWaffle/Portfolio-Full-Stack | /api/main.go | Go | go | 570 | permissive | package main
import (
"Angular-Go/api/server/handler"
"Angular-Go/api/server/platform/newsfeed"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func main() {
feed := newsfeed.New()
r := gin.Default()
config := cors.DefaultConfig()
config.AllowOrigins = []string{"http://localhost:4200"}
r.Use(cor... |
c3e06f403b25c209cbc89714fc9a64e78a797b18 | fbb3e83289a7696b25ac870b4f6ace87810d0366 | Seasheller/grafana | /pkg/api/common.go | Go | go | 2,662 | permissive | package api
import (
"encoding/json"
"net/http"
m "github.com/Seasheller/grafana/pkg/models"
"github.com/Seasheller/grafana/pkg/setting"
"gopkg.in/macaron.v1"
)
var (
NotFound = func() Response {
return Error(404, "Not found", nil)
}
ServerError = func(err error) Response {
return Error(500, "Server erro... |
fdfcc292211f0cd44aa2739e014e4d892fac3f3f | 582fe0a0011fb478301a4cc4bac71c4bcf323380 | lvgilmore/k8s-ExternalLB | /pkg/plugins/haproxyCluster/keepalivedconfig.go | Go | go | 4,275 | no_license | package haproxyCluster
import (
"os"
"github.com/SchSeba/k8s-ExternalLB/pkg/loadbalancer"
"text/template"
"bytes"
"log"
"os/exec"
"fmt"
)
type KeepalivedConfig struct {
Interface string
State string
VirtualInterface map[string]VirtualInterface
Config string
}
type VirtualInterface struct {
Name string
... |
b03117e5dfb0bebaa407b1fcbe4b7fc947963d00 | fcdfc39e5c884410f2c559f64b59e3d71aa5c1e5 | darkhelmet/fetch | /src/pkg/storage/storage.go | Go | go | 342 | permissive | package storage
import (
"fetch/tokenizer"
)
type Engine interface {
Store(index, scope, id, field string, tc tokenizer.TokenChan) bool
Delete(index, scope, id string) bool
SearchField(index, scope, field string, tc tokenizer.TokenChan) chan string
SearchScope(index, scope string, tc tokenizer.Tok... |
f19d0566d51d2ccd1fe8762af8c508ea964ed6e8 | 97da95eb329fbfc9cb4e61bdacfdd1c0c068030b | jsrzx/goduck | /cmd/goduck/fabric/fabric.go | Go | go | 3,543 | permissive | package fabric
import (
"fmt"
"path/filepath"
"github.com/meshplus/goduck/internal/repo"
"github.com/meshplus/goduck/internal/types"
"github.com/meshplus/goduck/internal/utils"
"github.com/urfave/cli/v2"
)
func GetFabricCMD() *cli.Command {
return &cli.Command{
Name: "fabric",
Usage: "Operation about fab... |
eaba76e6d9e97d222d240e7b632a3538849fff13 | a034b0bb56465f8f2368959131d98d69ea30df22 | libopenstorage/operator | /drivers/storage/portworx/component/securitycontextconstraints.go | Go | go | 9,406 | no_license | package component
import (
"context"
"fmt"
"reflect"
"strconv"
"github.com/hashicorp/go-version"
ocp_secv1 "github.com/openshift/api/security/v1"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/e... |
0c6e86d1df1ad53adf37b3e64b79073f8d1ca36a | b1b76c16271295eb79d6fa42d38d52b5c7cb4b85 | allthingsclowd/HashiStack-on-arm | /pkg/builder/step_resize_fs.go | Go | go | 1,908 | permissive | package builder
import (
"bytes"
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type stepResizeFs struct {
PartitionsKey string
}
func (s *stepResizeFs) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
wrappedCommand := state.Get("... |
fc9712ef278b95a90e8b785f1d945b2a8833ec74 | 167a07a7a310075206e525d739a879f63773109d | sgtest/monorepo-test-3 | /kubernetes-11/pkg/apis/imagepolicy/v1alpha1/zz_generated.conversion.go | Go | go | 7,223 | permissive | // +build !ignore_autogenerated
/*
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 applica... |
327a901b1ccf3785b7954a1df8ce12cdab9b7462 | 1407db932ab5f510c77b3af352c43634a3717d7e | nats-io/nsc | /cmd/contextconfig_test.go | Go | go | 4,705 | permissive | /*
* Copyright 2018 The NATS 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... |
b2b99effee386475d4b537969e5589c352c86964 | 8f0de50374346c6befaa2bc48f1bcb1978548535 | ajm188/vitess | /go/vt/orchestrator/inst/instance_dao.go | Go | go | 109,170 | permissive | /*
Copyright 2014 Outbrain 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 w... |
bacc3a12a7de687a1f2c68b6596afb12cdc89812 | 1d51a1174bd978e581305c19576b8bf2adc43582 | zyfdegh/hiupdate | /server/api/record.go | Go | go | 1,675 | permissive | package api
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"github.com/zyfdegh/hiupdate/server/entity"
"github.com/zyfdegh/hiupdate/server/service"
)
// GetRecord serves GET /record?name=ZhangSan&date=20160906
func GetRecord(w http.ResponseWriter, req *http.Request) {
var name = req.FormVa... |
072902095abb38d811a635d13cfa53385fc6914c | 88fc2ef5f27105492f34e08858020f722cb980a1 | lightsgoout/go-quantcup | /engine.go | Go | go | 8,690 | no_license | /*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager (Go port by rdingwall@gmail.com)
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (p... |
e2a47d6a09563c09234a1d810cc5d6fdd93199c4 | f230c510ae5178f4e979fbb00e0a28febdfbfd53 | TomRoSystems/opentelemetry-collector-contrib | /receiver/mysqlreceiver/client.go | Go | go | 2,184 | permissive | // Copyright OpenTelemetry 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... |
02df4090a4921c8a6e8c532735bfd4177fcd7a79 | 995550e93f476a7deb82835f34a6b69370a640c6 | liveball/micro-service | /http/hello.go | Go | go | 665 | permissive | package http
import (
"context"
"log"
hello "github.com/liveball/micro-service/service/hello/proto"
"github.com/gin-gonic/gin"
)
type Say struct{}
var cli hello.SayService
//Anything for test
func (s *Say) Anything(c *gin.Context) {
log.Print("Received Say.Anything API request")
c.JSON(200, map[string]strin... |
26f57755bd802194336cdf2ecff5d42a9e465e6a | 2a42d833a8d055b6cb4ed4762630fecd99402d86 | gotd/td | /telegram/message/entity/format_test.go | Go | go | 1,043 | permissive | package entity
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/gotd/td/tg"
)
func TestBuilder_TextRange(t *testing.T) {
var (
a = require.New(t)
b Builder
)
_, _ = b.WriteString("abc")
a.Equal("abc"[1:2], b.TextRange(1, 2))
a.Equal("abc"[0:0], b.TextRange(0, 0))
panicRanges := [][... |
a01876fbb977c4f392176f9835d41013619c1345 | 87f29c53cdc23391bbd11ccbf957ebe298fbdc7a | xirtah/gopa-spider | /modules/index/ui/common/config.go | Go | go | 979 | permissive | /*
Copyright 2016 Medcl (m AT medcl.net)
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, so... |
b208f06093061478ba770c9b09728fd8a6afa2b6 | d9d8cb81d5b2eb10a96bfbe429f63fc6791ca120 | fastgoo/syncd | /module/user/group.go | Go | go | 2,806 | permissive | // Copyright 2018 syncd Author. All Rights Reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package user
import (
"github.com/tinystack/goutil/gostring"
"github.com/tinystack/goweb"
"github.com/dreamans/syncd"
userService "github.com/dre... |
93d7270be9d1f9433b12d80a5efded8c7fac2c42 | d21fa81947599ea0fe90a100726b6203344f7d07 | Brian-McM/felix | /fv/wireguard_test.go | Go | go | 45,072 | permissive | // Copyright (c) 2020-2021 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 ... |
5c7d26fb249faf94404b6a91d04d5fc48b8fff72 | 129eecd09389190f2d3bc4fc0e4d438c7c5bc26f | bitvalues/ruby-lobby | /src/servers/view/handler-version-check.go | Go | go | 367 | no_license | package view
import (
"encoding/hex"
"github.com/bitvalues/ruby-lobby/src/sessions"
"github.com/davecgh/go-spew/spew"
)
func (s *ViewServer) handleVersionCheck(buffer []byte, session *sessions.Session) {
// make sure the buffer is of correct size
if len(buffer) < 28 {
return
}
// debugging
spew.Dump("PARS... |
656580a539d6236234a92f3124bde1be558708bf | f797930d6d5bc02502df840f1ce51ecf3cac6fa0 | traPtitech/gitea | /models/migrations/v1_14/v166.go | Go | go | 2,946 | permissive | // Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_14 //nolint
import (
"crypto/sha256"
"encoding/hex"
"golang.org/x/crypto/argon2"
"golang.org/x/crypto/bcrypt"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/scrypt"
"xorm.io/builder"
"xorm.io/xorm"
)
func... |
5c94c6109deaaf2f95ad67f618d05ecd9dcb0b12 | 34247aac752b76d316609b42be94632bbf43ec09 | itsinthebag/fluid | /pkg/utils/tieredstore/tiered_store.go | Go | go | 2,738 | permissive | /*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License ... |
c808ff6228341462c827caf66bd14131143013e6 | 0252f870e658a4349fc334ae93beea5d3077f604 | dani3l8200/MIA_PROYECTO1 | /lwh/checkerCommandsOM.go | Go | go | 6,817 | no_license | package lwh
import (
"fmt"
"strings"
)
// CheckMKdisk funcion para verificar las entradas obligatorias
func CheckMKdisk(aux Node) bool {
var sizeCheck bool = false
var pathCheck bool = false
var nameCheck bool = false
var unitChekc bool = false
for _, i := range aux.Children {
if i.TypeToken == "SIZE" {
s... |
52329a980feb954b7a5513c21f48a91a4f1c945a | f7c3afb02d971edb78ebf1f25d32505b54a0eb5c | sniperZj/unioffice-examples | /spreadsheet/lots-of-rows/main.go | Go | go | 1,560 | no_license | // Copyright 2017 FoxyUtils ehf. All rights reserved.
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime/pprof"
"time"
"github.com/unidoc/unioffice/common/license"
"github.com/unidoc/unioffice/spreadsheet"
)
const licenseKey = `
-----BEGIN UNIDOC LICENSE KEY-----
Free trial license keys are available at:... |
92724d63a129c3fe0a2f864d8a35890abd83c383 | 50290f88825a79d294171ddd441ab80c73fcfe1e | khlieng/dispatch | /vendor/github.com/blevesearch/zap/v14/count.go | Go | go | 1,759 | permissive | // Copyright (c) 2017 Couchbase, 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... |
1dedae403a8ad298fa8e37d79d5807551eda072b | e591b2cc6ce42ab713f585a94d78085bc46f6c06 | szaher/go-rest-api | /src/srest/todo.go | Go | go | 262 | no_license | package srest
import "time"
type Todo struct {
Id int `json:"id"`
Name string `json:"name"`
Completed bool `json:"completed"`
Due time.Time `json:"due"`
}
type Todos []Todo
type MyError struct {
code int `json:"code"`
Message string `json:"message"`
} |
576eb9a53ec3ba1280df1b379edb598c37df36e1 | 343facebb7cc4b1a1f0ba4d8f37bdc053a990877 | jrivets/log4g | /log_level_setting_test.go | Go | go | 1,185 | permissive | package log4g
import (
"github.com/jrivets/gorivets"
. "gopkg.in/check.v1"
)
type logLevelSettingSuite struct {
}
var _ = Suite(&logLevelSettingSuite{})
func (s *logLevelSettingSuite) TestSetLogLevel(c *C) {
ss, _ := gorivets.NewSortedSlice(2)
setLogLevel(INFO, "a.b", ss)
setLogLevel(INFO, "a", ss)
setLogLeve... |
db69b2423cdebc787225a5ddf259408a9ea0e274 | 6c85f9d1dfc2467425fcd9b1feaa012dda6d95cb | dolthub/dolt | /go/cmd/dolt/fileno_check_linux.go | Go | go | 948 | permissive | // Copyright 2019 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
bee9f19947129e0a9ccc57533ade36befab86ef2 | c79ab04c8274772287d13c53b1ef405685d597e8 | chinnareddy578/kubernetes | /pkg/apis/apps/validation/validation_test.go | Go | go | 115,353 | 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, ... |
1f284ed95900c50fb7e792a0ecd338fae00b2f35 | c7b87b772fa7e2036350e159b9e9df4c170cadb1 | zjregee/EasyProxy | /proxy.go | Go | go | 5,424 | no_license | package main
import (
"bufio"
"fmt"
"net"
"os"
"io/ioutil"
"regexp"
"strings"
)
type MethodType int
const (
Method_GET MethodType = 0
Method_POST MethodType = 1
)
func (m MethodType) String() string {
switch (m) {
case Method_GET: return "GET"
case Method_POST: return "POST"
default: return "UNKNOWN"
... |
51b21cf8f07607c3f2cc110ea6183f232a832c5d | c6f349f7b95ad0065448b2604d070044312407b9 | aruaru0/golang_myatcoder | /PM9/210509/F/main.go | Go | go | 5,848 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func out(x ...interface{}) {
fmt.Fprintln(wr, x...)
}
func getI() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
... |
d4f77079b67c1d95281eaab80e8702504ce80d0a | f7dd91bf2822e1897cad1e6ab3f65bbc5f046ccf | boohyunsik/ibc | /handler.go | Go | go | 3,517 | permissive | package ibc
import (
"fmt"
"github.com/DE-labtory/ibc/spec"
)
// Handler is implementation of Handler interface.
type Handler struct {
privateStore *PrivateStore
provableStore *ProvableStore
}
func (h *Handler) CreateClient(id spec.Identifier, clientType spec.ClientType, consensusState spec.ConsensusState) {
p... |
655b7342361ff4d5a1fc6ada6dbbb2dd767d0b55 | 59fc51cebbc08c3ec80f7db7bd764846d9f17f99 | ueokande/livegreptone | /lgrunner/name.go | Go | go | 895 | permissive | package lgrunner
const (
// IndexVolumeName is a volume name for the index files in livegrep
IndexVolumeName = "livegrep-index"
// WebContainerName is a container's name of the web server
WebContainerName = "livegrep-web"
// WebHostName is a container's hostname of the web server
WebHostName = "livegrep-web"
... |
c0f1940b2a37ee6f8b1a5ed16c546436dc996488 | d7ad1c5dbcc4f3f6c14e2730f737563423eabfc6 | yk-sgr/shards | /manager.go | Go | go | 4,730 | permissive | package shards
import (
"sync"
"time"
"github.com/bwmarrin/discordgo"
)
type Manager struct {
sync.RWMutex
// Discord gateway.
Gateway *discordgo.Session
// Discord intent.
Intent discordgo.Intent
// Shards managed by this Manager.
Shards []*Shard
// Total Shard count.
ShardCount int
// Event handlers... |
d9ce504f2a867fd8730ff7baae3275f400d5175f | ebf1f9c9f2d8da2c784e0e19abd2a9fc188a2b1c | jromero/kpack-cli | /pkg/clusterstore/factory.go | Go | go | 3,839 | permissive | // Copyright 2020-Present VMware, Inc.
// SPDX-License-Identifier: Apache-2.0
package clusterstore
import (
"strings"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/pivotal/kpack/pkg/apis/build/v1alpha2"
corev1alpha1 "github.com/pivotal/kpack/pkg/apis/core/v1alpha1"
"github.com/pkg/errors"
meta... |
591493a8b4a2af083c5f3bc35a728a36b4dc4041 | 50ad3018dbc9ddf660ca77438d60c79c4555de43 | andybrucenet/kubernetes | /plugin/pkg/admission/persistentvolume/label/admission.go | Go | go | 6,297 | permissive | /*
Copyright 2015 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, ... |
696b2aed00aa0e05082558abd456e46c70ae53b9 | 20a9c351407d20edcf8e5677319bcf993f165df3 | veritastry/Go | /Gin/13_gin项目案例/gin-web-server-framework/docs/docs.go | Go | go | 5,051 | permissive | // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-09-16 11:36:07.807589 +0800 CST m=+0.051206646
package docs
import (
"bytes"
"encoding/json"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"sw... |
79e4531671c1dc8facbc714f94be25b2de67920b | a4e99ae4c6de66e3b9204189ab2e0ae76ed22784 | apelisse/kubernetes | /contrib/mesos/pkg/minion/config/config.go | Go | go | 985 | permissive | /*
Copyright 2015 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, ... |
54d10e64b5b378c77ce90d56529269c0f2054740 | 5017a4061bb13ee510c2e0d5da2c29d151b6a3d8 | AdamColton/buttress | /validate/validatebp/library.go | Go | go | 1,922 | no_license | package validatebp
import (
"fmt"
"github.com/adamcolton/gothic/gothicgo"
"github.com/adamcolton/gothic/gothicio"
"io"
)
var tooShort = `if len(%s.%s) < %s && len(%s.%s) > 0 {
r.AddToField("%s", "Too Short")
}
`
func MinLength(value, name string, field *gothicgo.Field, strct *gothicgo.Struct) io.WriterTo {
s :... |
8274ac31aee32cd9047e31713aa36e453baf40c7 | 4c89ad4748e21b4ad46ce98546c64d5913e1c8a0 | GoogleCloudPlatform/golang-samples | /run/testing/grpc_server_streaming.e2e_test.go | Go | go | 2,642 | 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.