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 |
|---|---|---|---|---|---|---|---|---|
c73e48451e915e97348e88cad5daa741889db8aa | e683b80b2ac2162d4da88155eacfd938c0ff9d9a | jlhonora/honorato.org | /server/server.go | Go | go | 1,680 | no_license | package main
import (
"fmt"
_ "github.com/lib/pq"
"html/template"
"log"
"net/http"
"time"
)
var templates = template.Must(template.ParseFiles("../index.html"))
func renderTemplate(w http.ResponseWriter, tmpl string) {
err := templates.ExecuteTemplate(w, tmpl+".html", nil)
if err != nil {
http.Error(w, err.... |
69fbf1549fd84bebb8cefea3e1b41c26ab4b59bd | d8349d989e8fa185687ed9a687aeb7006472c390 | junxie6/UVa | /10034/10034.go | Go | go | 1,043 | permissive | // UVa 10034 - Freckles
package main
import (
"fmt"
"math"
"os"
)
type point struct{ x, y float64 }
func distance(p1, p2 point) float64 {
return math.Sqrt((p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y))
}
func prim(freckles []point) float64 {
visited := make(map[int]bool)
visited[0] = true
var total floa... |
1f9cccd538048770270c1b20707cb07e72ab6f25 | d930f83a438ee3bf03dc32682168517e2bf74e96 | google/nel-collector | /cmd/nel-collector/main.go | Go | go | 1,662 | permissive | // Copyright 2018 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 ... |
495fb351799d357432a09ec38b9bd4d47dae274f | 07a1119773094786dd4f740aee064b262cf54a07 | XuPeng-SH/aoe_prototype | /pkg/metadata/types_test.go | Go | go | 1,376 | no_license | package metadata
import (
"github.com/stretchr/testify/assert"
"testing"
// "time"
)
func TestCache(t *testing.T) {
// blk := Block{}
// assert.False(t, blk.HasRef())
// curr, succ := blk.Unref()
// assert.Equal(t, curr, uint64(0))
// assert.False(t, succ)
// blk.Ref()
// assert.True(t, blk.HasRef())
// cu... |
58752e5b502e0a6cce5c0af2fb2c74de701e6c85 | 001667263f90260a022a54119ed5536193eaca57 | dxps/go-merkle-trees-playground | /codenotary___merkletree/example_test.go | Go | go | 4,263 | permissive | /*
Copyright 2019-2020 vChain, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
01abaf5e16975ca750076b5419f561b36e74f88b | 7e336906efb14e16edfca1e6ceb67f70070edb0b | hugcoday/phalgo | /request.go | Go | go | 7,660 | no_license | // PhalGo-Request
// 请求解析,获取get,post,json参数,签名加密,链式操作,并且参数验证
// 喵了个咪 <wenzhenxi@vip.qq.com> 2016/5/11
// 依赖情况:
// "github.com/astaxie/beego/validation" 基于beego的拦截器
// "github.com/labstack/echo" 依赖于echo
package phalgo
import (
"strconv"
"github.com/labstack/echo"
"github.com/astaxie/beego/validat... |
dbef08ef7c3cade613a8b3e729f5e685a36c72b8 | faa3cae0644bbbad21adb0a729abb7dc0e2aa71d | junotx/notification | /pkg/plugins/email_notifier.go | Go | go | 1,719 | permissive | // Copyright 2019 The OpenPitrix Authors. All rights reserved.
// Use of this source code is governed by a Apache license
// that can be found in the LICENSE file.
package plugins
import (
"context"
"openpitrix.io/logger"
"openpitrix.io/notification/pkg/constants"
"openpitrix.io/notification/pkg/gerr"
"openpit... |
0fc6e0b7b231729345ad7af3ca78c68bf9383410 | ec8e781cde31b28e83216fdea21a67851704f3a6 | yeya24/agent | /pkg/integrations/manager_test.go | Go | go | 9,159 | permissive | package integrations
import (
"context"
"fmt"
"testing"
"time"
"github.com/cortexproject/cortex/pkg/util/test"
"github.com/go-kit/kit/log"
"github.com/gorilla/mux"
"github.com/grafana/agent/pkg/integrations/config"
"github.com/grafana/agent/pkg/prom/instance"
"github.com/prometheus/client_golang/prometheus/... |
62dfd587c368dc7ffc1c785751d082e95a43e87d | 29a3595b6d5de03eafa7a92000da12013a7e23fa | KanjengDev/market-fish-service | /auth/service.go | Go | go | 1,009 | no_license | package auth
import (
"errors"
"os"
"github.com/dgrijalva/jwt-go"
)
type Service interface {
GenerateToken(userID uint) (string, error)
ValidateToken(token string) (*jwt.Token, error)
}
type jwtService struct {
}
var SECRET_KEY = []byte(os.Getenv("JWT_SECRET"))
func NewService() *jwtService {
return &jwtSer... |
875fede9bd28bfbae4f33c8ad1799dd27bc710b9 | 48ea19625d0d927c2c0e11baf5360a2b8d9f2ea6 | jlbribeiro/adventofcode | /2017/day13/part2/firewall/main_test.go | Go | go | 1,046 | no_license | package firewall_test
import (
"fmt"
"testing"
"github.com/jlbribeiro/adventofcode/2017/day13/part2/firewall"
)
type testLayer struct {
depth int
scanningRange int
}
var undetectedWalkDelayTests = []struct {
layers []testLayer
expected int
}{
{
layers: []testLayer{
{
depth: 0,
... |
fddc0e77b224b76fd8c76c944a8c805e0ea34032 | 093c12c6f312d46ab35d5a4ddd1bc03c0cc83236 | clix-dev-llc/rekor | /pkg/types/rpm/v0.0.1/entry_test.go | Go | go | 11,165 | permissive | /*
Copyright © 2021 Bob Callaway <bcallawa@redhat.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 or agreed to... |
9e7e619585872643d97891433ad9fcc2f1291fe4 | 05a4236afd43a43906c567572ce24f24a35c569b | ocakhasan/simple-api-task | /models/mongo/mongo_test.go | Go | go | 1,378 | no_license | package mongo_test
import (
"testing"
"github.com/ocakhasan/getir-api-task/models/mongo"
"github.com/ocakhasan/getir-api-task/controllers/errors"
"github.com/ocakhasan/getir-api-task/controllers/requests"
)
func TestCreatePipe(t *testing.T) {
type args struct {
filter requests.MongoRequestBody
}
tests := ... |
f49f641c5fb86effd3a77fae1820b6194db34532 | fca7fedb852c573bdbba5fce58f2fec6937afbc5 | redspread/localkube | /vendor/github.com/coreos/etcd/raft/status.go | Go | go | 1,821 | 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... |
fda00c570397431befd22350952277818bbef685 | 936a37e476059de21cc89eff6a3960285b1e8768 | chhlatnash/origin | /pkg/authorization/registry/rolebinding/rest.go | Go | go | 2,747 | permissive | package rolebinding
import (
"fmt"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
kerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
authorizationapi "github.com/openshift... |
b46be56e4ad79a3b88d9bc2c57f12bb9b71177a9 | a42d99b0e88465fa7029c19081ee7487ee1f460a | VahidMostofi/test_go_modules | /internal/unique/UniqueDatabase.go | Go | go | 477 | no_license | package unique
import mapset "github.com/deckarep/golang-set"
// UniqueDatabase ...
type UniqueDatabase struct {
set mapset.Set
}
func (ud *UniqueDatabase) init() {
set := mapset.NewSet()
ud.set = set
}
// Add ...
func (ud *UniqueDatabase) Add(value interface{}) error {
if ud.set == nil {
ud.init()
}
ud.set... |
65ef911e896a7cafdf2d38546531c9f0e7533766 | c9a47fc674aebeca65f805cfac88580e82acbe2e | spotinst/kubernetes-kops | /vendor/k8s.io/kubectl/pkg/cmd/util/editor/editoptions.go | Go | go | 27,085 | 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, ... |
0c611afe6166f08150c1aa820abc864cdaf92bd3 | 5a88f4be1362dbd50ee73d05f7fea1229e7d015f | bake/adventofcode-2018 | /day-06/grid/grid.go | Go | go | 3,285 | no_license | package grid
import (
"fmt"
"image"
"image/color"
"image/color/palette"
"strconv"
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"
"golang.org/x/image/math/fixed"
)
const (
// the fields default value describes an empty field, therefore ids have to
// start at 1.
fieldEmpty = 0
// equally fa... |
69c8908e4bd56492c5ed7e9544534a5194a75815 | d3b7a7092061012b51d229f9e562f4f5c6e7ffc5 | transcom/mymove | /pkg/models/moving_expense.go | Go | go | 4,835 | permissive | package models
import (
"time"
"github.com/gobuffalo/pop/v6"
"github.com/gobuffalo/validate/v3"
"github.com/gobuffalo/validate/v3/validators"
"github.com/gofrs/uuid"
"github.com/transcom/mymove/pkg/unit"
)
// MovingExpenseReceiptType represents types of different moving expenses
type MovingExpenseReceiptType ... |
079e3b2beabd69c542249f34c33bb7796b2f15f8 | eef50d4f2be076687121192a2bc65a0e52884a2a | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/devtestlab/v20180915/user.go | Go | go | 5,446 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20180915
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Profile of a lab user.
type User struct {
pulum... |
dd8926b13ea00ee902c45ba1f51f7c65de11bd5e | 6de968f4fddb94552c08e40f0948d56bc2e7b857 | trazfr/prometheus-timechef-exporter | /main.go | Go | go | 450 | permissive | package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
if len(os.Args) != 2 {
fmt.Println(os.Args[0], "<config>")
os.Exit(1)
}
config := NewConfig(os.Args[1])
prometheus.MustRegister(Ne... |
13c5a28fcfad3d729c1d4e94ceb7bf76b2e7030a | 16386eeeddf18cef8a1e3593133440ba2be4ffed | crtn32002/sourcegraph | /internal/db/query/query_test.go | Go | go | 2,510 | permissive | package query_test
import (
"fmt"
"log"
"testing"
"github.com/keegancsmith/sqlf"
"github.com/pkg/errors"
"github.com/sourcegraph/sourcegraph/internal/db/query"
)
func ExampleEval() {
q := query.And(
query.Or("foo", false),
query.Not("bar"),
true)
rq, err := query.Eval(q, func(q query.Q) (*sqlf.Query, ... |
602d9567901f53aa669dc8a6c7ef705ec9b810f5 | a11fc72af2a1d359f8cf0a0e907a70bfadb71831 | mj-hd/fungen | /fungen_auto.go | Go | go | 835 | permissive | // Package main - generated by fungen; DO NOT EDIT
package main
// GeneratorList is the type for a list that holds members of type Generator
type GeneratorList []Generator
// Filter is a method on GeneratorList that takes a function of type Generator -> bool returns a list of type GeneratorList which contains all mem... |
ae3fa5d0534b284f21bfb7fe7c32273075b43348 | 1c166563599fd8f95dc3c7fa236a109de2b209a3 | petarov/sandbox | /go/saugen/main.go | Go | go | 963 | permissive | package main
import (
"fmt"
"log"
"time"
)
var (
VERSION = "1.0"
)
func main() {
fmt.Printf("*** BITTE ALLE IMPFEN! v%s\n", VERSION)
ctx, err := init116117()
if err != nil {
log.Fatalf("client init error: %v", err)
}
fmt.Println("Fetch index ...")
if err := GetIndex(ctx, nil); err != nil {
log.Fatalf... |
75dac9d011b35428460da6ef8999acb026d5ba1d | 78ce797c366367a6bd6c561777ce27c3d3892955 | ljoly/npuzzle | /server/getStates.go | Go | go | 2,161 | permissive | package main
func swapTiles(tile1, tile2 int, board []int) bool {
if tile2 >= 0 && tile2 < e.boardSize*e.boardSize {
tmp := board[tile1]
board[tile1] = board[tile2]
board[tile2] = tmp
}
return true
}
func getXYfromIndex(index int) (int, int) {
x := index / e.boardSize
y := index % e.boardSize
return x, y
... |
5f3244fbffa216f13b359faa25327d4feca4c81a | 6c84b864610ff27de65747597ff06fc6d0b6d98b | dingyuanhong/hover | /cmd/build.go | Go | go | 8,559 | permissive | package cmd
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"github.com/otiai10/copy"
"github.com/spf13/cobra"
"github.com/go-flutter-desktop/hover/internal/enginecache"
)
var dotSlash = string([]byte{'.', filepath.Separator})
var (
buildTarget string
buildManifest string... |
523620d23363cf5dfafa80c21fe2d4ad96462255 | a2ca8404c0c5c285051c6ca56839a3b9bf996d30 | facturation/postmanerator | /postman/collection_v210.go | Go | go | 2,507 | permissive | package postman
type collectionV210 struct {
Info struct {
Name string `json:"name"`
Description string `json:"description"`
Schema string `json:"schema"`
} `json:"info"`
Item []collectionV210Item `json:"item"`
}
type collectionV210Item struct {
Name string `json:"name"`
D... |
3aad634fded9ee76aab57906c65371aae62a7380 | 04274dd90775c15a0d2bfb41df11787dced82190 | salesforcemagic/forcemagic | /lib/metadata.go | Go | go | 41,253 | permissive | package lib
import (
"archive/zip"
"bitbucket.org/pkg/inflect"
"bufio"
"bytes"
"encoding/base64"
"encoding/xml"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"reflect"
"strconv"
"strings"
"time"
. "github.com/heroku/force/error"
)
type BigObject struct {
DeploymentStatus string
Label ... |
4ce1bdf76d9a673552342a9fedd47705f6bb2113 | 01b30a8d67d944c0c73a0f8a93fd68220a1bc34d | levin9/gin-vue-admin | /common/codes/code.go | Go | go | 374 | permissive | package codes
//错误码定义
const (
SUCCESS = 200
ERROR = 500
InvalidParams = 400
ErrExistTag = 10001
ErrNotExistTag = 10002
ErrNotExistArticle = 10003
ErrAuthCheckTokenFail = 20001
ErrAuthCheckTokenTimeout = 20002
ErrAuthToken = 20003
ErrAuth = 20004
Er... |
f38fef84d0e3f18a83a62f5dc859c38fdb56987f | 7f9066ce7a8c91bc4ba9442eb56a8d54465f6556 | bigxiong/leetcode_golang | /9_palindrome_number/palindrome_number.go | Go | go | 293 | no_license | package main
func isPalindrome(x int) bool {
if x < 0 {
return false
}
if x%10 == 0 && x != 0 {
return false
}
var revertNumber int
for x > revertNumber {
revertNumber = revertNumber*10 + x%10
x = x / 10
}
return revertNumber == x || revertNumber/10 == x
}
func main() {
}
|
e79d5ea6311683b630ade841bf761ec4161b2f8e | c258884c39a7c43299ab91ae6611e6229d88c10e | dysnix/installer | /steps/cluster/types.go | Go | go | 739 | permissive | package cluster
import (
"fmt"
"git.arilot.com/kuberstack/kuberstack-installer/predefined"
"git.arilot.com/kuberstack/kuberstack-installer/protocol/gen/models"
)
// PriceFormat is a printf-compatible format for a string price representation
const PriceFormat string = "%.2f"
// GetTypes returns a copy of cluster ... |
ab13d505b6e61924d6441b1ba52ab60e2cd39d99 | 18dfc2b1b4a0f3b0c580c52e4cb942b7497a0022 | PieterD/warp | /pkg/dom/canvas.go | Go | go | 1,156 | no_license | package dom
import (
"fmt"
"github.com/PieterD/warp/pkg/gl"
)
type Canvas struct {
elem *Elem
}
func AsCanvas(elem *Elem) *Canvas {
if elem.Tag() != "canvas" {
return nil
}
return &Canvas{
elem: elem,
}
}
func (c *Canvas) GetContextWebgl() *gl.Context {
return gl.NewContext(c.elem)
}
func (c *Canvas) ... |
677bec19cc58191097060244504e8e19f84a7501 | ad4fc24683bb9227f10237be133b98c6a9516710 | LakenLi/Go- | /Code/go-programming-tour-book/blog-service/pkg/app/form.go | Go | go | 972 | no_license | package app
import (
"github.com/gin-gonic/gin"
ut "github.com/go-playground/universal-translator"
val "github.com/go-playground/validator/v10"
"strings"
)
type ValidError struct {
Key string
Message string
}
type ValidErrors []*ValidError
func (v *ValidError) Error() string {
return v.Message
}
func (v Val... |
3c5830526f499520cd4b02223a9b88142902ef07 | 3aedd8e1e889f53806b4ef81a90cf37e744d5ea3 | subash68/API-New | /s8_Notifications/models/storedProcedures.go | Go | go | 2,895 | no_license | // Package models ...
package models
import (
"github.com/jaswanth-gorripati/PGK/s8_Notifications/configuration"
)
// SP is a Mapping of procedure name to Procedure query
var SP map[string]string
// RetriveSP takes in the required Proceder name and returns the procedure
func RetriveSP(procedureName string) (string,... |
c71456ecc153bfaec0a6c826a75cab3993045cd4 | c1036124163a3078ff65e929e0915f83b89c0458 | openshift/installer | /vendor/github.com/microsoftgraph/msgraph-sdk-go/models/groupable.go | Go | go | 6,326 | permissive | package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// Groupable
type Groupable interface {
DirectoryObjectable
i878a80d2330e89d2... |
7d712d45354f735fbd24bd22b9ae35f6e6f99cf5 | f10f085d3099b361d99690dd574bdba13dc3946a | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/cache/getPrivateEndpointConnection.go | Go | go | 2,072 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package cache
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The Private Endpoint Connection resource.
// API Version: 2021-03-01.
func LookupPrivateE... |
1ee024e5db8cdf6e25c1e5a21cfe374e544f2939 | 37ed23fad76a59056f22f8e51378c70a47cd03a5 | erda-project/erda | /tools/cli/command/root_cmd.go | Go | go | 10,856 | 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... |
c3c772251ee94a2b151fb865abb563475468b801 | ddd88c5cbcba3ba31acaf8e4733dedac64ba56da | gunsluo/go-example | /attribute/attr/convert.go | Go | go | 2,715 | permissive | package attr
/*
import (
"github.com/gogo/protobuf/types"
"github.com/gunsluo/go-example/attribute/acpb"
"github.com/pkg/errors"
)
func ConvertCondition(c *acpb.Condition) (Condition, error) {
fn, ok := ConditionFactories[c.Type]
if !ok {
return nil, errors.Errorf("Condition %s not found", c.Type)
}
nc := ... |
c31cf2d9a053b3a4565a58cfed22c974a2c353e6 | 7838d680ababd9ecfc182245bda3fcd47a7da981 | thunder-spb/glinv | /web/cmd/web/main.go | Go | go | 4,848 | permissive | package main
import (
"database/sql"
"flag"
"fmt"
"log"
"net/http"
"os"
"text/template"
"time"
"github.com/golangcollege/sessions"
_ "github.com/lib/pq"
"github.com/vharitonsky/iniflags"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/postgres"
_ "github.com/golang... |
0f0b0b69b6363e6a40b116181b4240820bb601c0 | 78b962c1555a825153986b63d5a15c80f7dc0308 | gocuntian/go-gui | /demo4/main.go | Go | go | 587 | no_license | package main
import (
"log"
"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/window"
)
// GO语言使用GO-SCITER创建桌面应用(四) 固定窗口大小
// 有些时候我们需要创建的应用窗口大小不可改变。
func main() {
//创建窗口并设置大小
w, err := window.New(sciter.DefaultWindowCreateFlag, &sciter.Rect{200, 200, 500, 500})
if err != nil {
log.Fatal(err... |
7f9dc495e2c302449aaf61f8c90f6dae1e728cc3 | 320d830531887b42e40b39a89b0e2b9334548070 | pauldthomson/opentelemetry-go | /internal/metric/mock.go | Go | go | 4,490 | permissive | // Copyright The 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 agre... |
d9f13bcaf8064037237e0700015b953b5e14659f | 60908e34745e26db64b576540bd45a911b063305 | kokarn/telegraf | /Godeps/_workspace/src/github.com/influxdb/influxdb/client/influxdb.go | Go | go | 17,356 | permissive | package client
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/influxdb/influxdb/models"
)
const (
// DefaultHost is the default host used to connect to an InfluxDB instance
DefaultHost = "localhost"
// DefaultPort is the d... |
d036ee4ef16f17c45516a2522c4a44f17314f2f1 | 8afd07518bbd8c4046ac4981d926ecb9dc4cf316 | wangfeiping/go-coding | /models/merge_request_detail_d_t_o.go | Go | go | 1,788 | permissive | package models
import "github.com/go-swagger/go-swagger/strfmt"
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
/*
MergeRequestDetailDTO merge request detail d t o
swagger:model MergeRequestDetailDTO
*/
type MergeRequestDetailDTO s... |
51b44d9657d7ca41beb4065f2bda009fa4c958ac | 6a981840354a14944ac0009669b065a344b237bd | ingrammicro/cio | /firewall/discovery/windows.go | Go | go | 4,543 | permissive | // Copyright (c) 2017-2021 Ingram Micro Inc.
//go:build windows
// +build windows
package discovery
import (
"bufio"
"bytes"
"fmt"
"os/exec"
"regexp"
"strconv"
"strings"
)
const (
windowsFirewallRuleNameHeader = "\r\nRule Name:"
)
var whiteSpaces = regexp.MustCompile("\\A\\s*\\z")
var ruleField = regexp.Mu... |
a339a665d75adb189d8237f9962967852e212318 | 5bfa2468f06d62018c0e80b8e45629f12b5c329b | asoorm/graphql-go-tools | /pkg/subscription/executor_v2.go | Go | go | 2,201 | permissive | package subscription
import (
"bytes"
"context"
"sync"
"github.com/wundergraph/graphql-go-tools/pkg/ast"
"github.com/wundergraph/graphql-go-tools/pkg/engine/resolve"
"github.com/wundergraph/graphql-go-tools/pkg/graphql"
)
// ExecutorV2Pool - provides reusable executors
type ExecutorV2Pool struct {
engine ... |
f02bc14b1f7c2782f9038b6419eb014359f22cee | dbe7119a011e0b41bdcc32d86395051d2bca834c | kubernetes-sigs/cluster-api-provider-vsphere | /pkg/context/vmware/guest_cluster_context.go | Go | go | 1,084 | permissive | /*
Copyright 2021 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, ... |
0e741d3972d05e864962e953da73921793b902c7 | 07fab7f1ba199e88b546206e3e1a33941a12fb73 | Logandata/aspose-pdf-cloud-go | /screen_annotation.go | Go | go | 2,357 | permissive | /**
*
* Copyright (c) 2020 Aspose.PDF Cloud
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge... |
c792bbf756c55f4c7e4a37dd09bb70bad10f468d | 34e1c44b05d714f75a0d947e75ff37590b0fce28 | code4happylife/learn-go-with-tests | /for/v1/repeat.go | Go | go | 338 | permissive | package iteration
// Repeat returns character repeated 5 times
func Repeat(character string) string {
var repeated string
for i := 0; i < 5; i++ {
repeated = repeated + character
}
return repeated
}
func repeatAgain(subStr string) string {
var repeatStr string
for i:=0 ; i< 6; i++{
repeatStr += subStr
}
r... |
1ba64c3cce91fb4c3e626d30c8db3b1fade19c74 | 9fea4b48b3c50e85cffc58d1ce665157e5c5422e | NiceAir/Gotest | /ch1/dup2.go | Go | go | 618 | no_license | package main
import (
"fmt"
"os"
"bufio"
)
func main() {
counts_map := make(map[string]int)
files := os.Args[1:]
if len(files) == 0 {
countLines(os.Stdin, counts_map)
}else {
for _, arg := range files {
f, err := os.Open(arg)
if err != nil {
fmt.Fprintf(os.Stderr, "dup2 %v\n", err)
}
co... |
d3e107db001ba51241e89739abd1152a856320e6 | 4ea662cf72c05fc6f4904badde4dd823db2f963c | faozimipa/go-book-store-api | /api/controllers/users.go | Go | go | 1,761 | permissive | package controllers
import (
hc "book-store-api/api/constants"
"book-store-api/api/models"
r "book-store-api/api/repositories"
"book-store-api/config/driver"
"book-store-api/handler"
"encoding/json"
"net/http"
)
type Users struct {
userRepo models.UsersRepo
}
func NewUserHandler(db *driver.DB) *Users {
retu... |
ed404f4682fdacd917cc3532a17f28b1212eff6d | cb497c2dd070e5a58c0c747c4a704b86a7c1cbec | stone-ch/ATLab-FabricFaster | /core/container/ccintf/ccintf.go | Go | go | 1,304 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package ccintf
//This package defines the interfaces that support runtime and
//communication between chaincode and peer (chaincode support).
//Currently inproccontroller uses it. dockercontroller does not.
import (
"fmt"
pb "gith... |
a718bd3ab07920a71ab1a015b4a0dd014c0bc525 | b7e2e8faf4982e0368e3fe9fecc6e49748446f2a | itpkg/ksana | /job/store_test.go | Go | go | 857 | permissive | package job_test
import (
"testing"
"time"
kj "github.com/itpkg/ksana/job"
ku "github.com/itpkg/ksana/utils"
)
var redis_p = ku.OpenRedisPool("localhost", 6379, 0)
var hello = "Hello, Ksana-Job!"
func TestStore(t *testing.T) {
test_store(t, kj.NewRedisStore(redis_p))
}
func test_store(t *testing.T, s kj.Store... |
6b5939480a7c3d9f719158c0d77207e5349e54af | ed9515ab4c5a11127ef17f2ea8c443552667187c | xingetouzi/dyupdater | /server/stores/csv.go | Go | go | 5,484 | no_license | package stores
import (
"math"
"os"
"path"
"runtime"
"sort"
"sync"
"fxdayu.com/dyupdater/server/common"
"fxdayu.com/dyupdater/server/models"
"github.com/deckarep/golang-set"
"github.com/gocarina/gocsv"
"github.com/spf13/viper"
)
type factorValueRecord struct {
TDate int `csv:"TDATE"`
SymbolCod... |
a4e435d24112ef90a7743701e5df171c727d0161 | 0e6172212bcf7cbd55a83e0eedef19047c172634 | ashwinsajiv/sysl | /cmd/sysl/databasescript_test.go | Go | go | 3,902 | permissive | package main
import (
"path/filepath"
"testing"
"github.com/anz-bank/sysl/pkg/loader"
"github.com/anz-bank/sysl/pkg/cmdutils"
"github.com/anz-bank/sysl/pkg/database"
"github.com/anz-bank/sysl/pkg/parse"
"github.com/anz-bank/sysl/pkg/syslutil"
"github.com/sirupsen/logrus/hooks/test"
"github.com/spf13/afero"... |
b9f76d38694753d9498dd5c675a64a65bced095b | 1b8110f9ac81d2832d1cc8543ca03ad34ad1a407 | yuanding717/assignments_template | /coursera-go/course3/sort.go | Go | go | 3,734 | no_license | //+build disabled
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
"sync"
)
// ReadStringLine reads a set of characters before ENTER is hit from a standard input (terminal)
func ReadStringLine() (string, error) {
stdinReader := bufio.NewReader(os.Stdin)
if inputString, err := stdinReader.ReadStr... |
63e21b52697c0ee5392e8f540a04b3da949a0612 | 789c089b55eff65995b7b95d234a008c3b86d775 | wenchangshou2/crontab | /worker/JobLock.go | Go | go | 2,232 | no_license | package worker
import (
"context"
"fmt"
"github.com/wenchangshou2/crontab/common"
"go.etcd.io/etcd/clientv3"
)
type JobLock struct {
kv clientv3.KV
lease clientv3.Lease
jobName string
cancelFunc context.CancelFunc //用于终止续租
leaseId clientv3.LeaseID
isLocked bool
}
//初始化一把锁
func InitJobL... |
defe564e11cb3576c4127e15f2c6aba418faac4e | ac78db01ab2f0e22a4ec556c712986dd88a619a7 | johnbirdau/pulumi-azure-native | /sdk/go/azure/migrate/v20191001/serverCollector.go | Go | go | 4,987 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20191001
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type ServerCollector struct {
pulumi.Cu... |
4c255507f8d6a0b4bfcab8fb796264c7664c95c2 | 68f19b0d7e6f7df8020d6839120cfd5b1c2aafc7 | canselcik/go-libtor | /openssl_crypto_x509v3_pcy_tree.go | Go | go | 254 | permissive | // go-libtor - Self-contained Tor from Go
// Copyright (c) 2018 Péter Szilágyi. All rights reserved.
package libtor
/*
#define OPENSSLDIR "/usr/local/ssl"
#define ENGINESDIR "/usr/local/lib/engines"
#include <crypto/x509v3/pcy_tree.c>
*/
import "C"
|
8684c03d652599c29623b7bbe6993378c2c4324d | 1031e11264413b33e4fb1a4dc9135deab2da24c3 | n3integration/reload | /main.go | Go | go | 2,492 | permissive | package main
import (
"os"
"gopkg.in/urfave/cli.v1"
"github.com/n3integration/reload/actions"
)
func main() {
app := cli.NewApp()
app.Name = "reload"
app.Usage = "A live reload utility for Go web applications."
app.Action = actions.Main
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "laddr,l",
Valu... |
9c62bff9e35db0a80eabf74add3a46a65050a427 | 4775b13d330aca3d19e372fadf93c7b8ad9d164f | deepfence/ThreatMapper | /deepfence_agent/tools/apache/scope/probe/plugins/max_bytes_reader.go | Go | go | 1,180 | permissive | package plugins
import (
"io"
)
// MaxBytesReader is similar to net/http.MaxBytesReader, but lets us choose how
// to handle an overflow by providing an error. net/http.MaxBytesReader uses
// net/http internals to render a naff error message. There are other
// discrepancies with how this detects overflows. Not sure... |
3fc06a8279094397d149b3fa78191f1f7587a2db | e8cfa20aae8243c87116eb64e74bdc9fd2ffb8d1 | Himly1/LAFITD | /erros/expression/core/condition/ConditionErrors.go | Go | go | 535 | no_license | package condition
type UnsupportedValueTypeError struct {
TheType string
}
func (UnsupportedValueTypeError UnsupportedValueTypeError) Error() string {
return "The type of the value does not support yet. The type is : " + UnsupportedValueTypeError.TheType
}
type UnsupportedOperationTypeError struct {
TheType str... |
a53bd17f4bb9ffe5e702d815be18b5357dce8f50 | d0f4272fcef1df3153692a74acdbbe0567fbe632 | royfooty/royfooty | /sqltocsv.go | Go | go | 1,546 | no_license | package main
import (
"database/sql"
"encoding/csv"
"fmt"
"os"
"strconv"
_ "github.com/lib/pq"
)
const (
host = "localhost"
port = 5432
user = "postgres"
password = "Cronaldo@7"
dbname = "test2"
)
func main() {
//connecting to database
psqlInfo := fmt.Sprintf("host=%s port=%d user=%s pas... |
b5cad743649935c0899e06c9c27996eee184a69c | c5980cab117e588deb90449c86d7f504b9860f87 | mamemomonga/miso-model1 | /go/hardware/sled.go | Go | go | 2,935 | no_license | package hardware
// SPI 74HC595
// 16Bit 2連結 LEDアレイ
import (
"github.com/janne/bcm2835"
"sync"
"time"
// "log"
)
type SpiLedArray struct {
led []uint8 // LED(0: 消灯 1:点灯 >1:点滅)
counter []uint8 // 点滅用カウンタ
pin []uint8 // ピンの状態
m *sync.Mutex // Mutex
sleep_timer ... |
4b7292e2df97bbea09bc5690f3039cb56ffd9864 | e78dbe58e0adc2ead39b3ba1dd2ee168077fcbca | Demonware/balanced | /cmd/tunnel-controller/hostpod_test.go | Go | go | 10,719 | permissive | package main
import (
"fmt"
"net"
"testing"
"github.com/golang/mock/gomock"
"github.com/Demonware/balanced/mocks"
"github.com/Demonware/balanced/pkg/apis/balanced/v1alpha1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite... |
106caa526194d59886ca699ae5807f85c383888c | 9937df8b5aac874bf17d3e457fdcc65bde8e7bf2 | cindywu/specs | /src/systems/filecoin_vm/runtime/impl/runtime.go | Go | go | 17,279 | permissive | package impl
import (
"bytes"
"encoding/binary"
ipld "github.com/filecoin-project/specs/libraries/ipld"
block "github.com/filecoin-project/specs/systems/filecoin_blockchain/struct/block"
actor "github.com/filecoin-project/specs/systems/filecoin_vm/actor"
addr "github.com/filecoin-project/specs/systems/filecoin_... |
9d3acb35873557a26762fcce58f3a03c4267df65 | 08a60caf06af5b92c1d6c7eab41f5b70f14d8acb | palasthotel/freistilbox | /version/version.go | Go | go | 360 | no_license | package version
import (
"fmt"
);
type Cmd struct{}
func (_ Cmd) Command() string {
return "version"
}
func (_ Cmd) Description() string {
return "shows the version info";
}
func (_ Cmd) Help(args []string) {
fmt.Println("There is no help available for version");
}
func (_ Cmd) Execute(args []string) {
fmt.P... |
38a75beac1cf331425d132f5a8e42be3a6e52407 | b57c6576a3fa5a8b694db63484583f1af44e445c | sslhound/modules | /orm/gorp/app/controllers/controller.go | Go | go | 1,579 | permissive | package gorpController
import (
"database/sql"
"github.com/revel/modules/orm/gorp/app"
"github.com/revel/revel"
)
// Controller definition for database transaction
// This controller is only useful if you intend to use the database instance
// defined in github.com/revel/modules/orm/gorp/app.Db
type Controller str... |
ff817b298590752ea0a70b1d31f1c19bc8993598 | 392661b8d378748915bf09b71070cfc2867cdac1 | milhamh95/test-with-go | /section-22-testing-with-time/timing/now.go | Go | go | 340 | no_license | package timing
import "time"
var (
timeNow = time.Now
)
type User struct {
UpdatedAt time.Time
}
func SaveUser(user *User) {
t := timeNow()
user.UpdatedAt = t
// ... save the user
}
type UserSaver struct {
now func() time.Time
}
func (us *UserSaver) Save(user *User) {
t := us.now()
user.UpdatedAt = t
// ... |
e883ccd032157989652361cb486fad21118ef7c2 | 9422aa4cd11607933caa405b564c9947cae89c98 | jkakar/dashi | /cmd/dashi-api/main.go | Go | go | 1,028 | permissive | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"github.com/jkakar/dashi"
"github.com/joeshaw/envdecode"
)
type config struct {
Port int `env:"PORT,default=8080"`
}
func main() {
cfg := &config{}
if err := envdecode.StrictDecode(cfg); err != nil {
log.Fatalf("loading config failed: %q", er... |
155c44f658b7dbd30aa954494241bd5a9b7e37b8 | f8125e4e923b30162985ee451179318bc75c3dba | degzhaus/geoip | /geoip.go | Go | go | 2,900 | permissive | /* Go (cgo) interface to libgeoip */
package geoip
/*
#cgo CFLAGS: -I/opt/local/include -I/usr/local/include
#cgo LDFLAGS: -lGeoIP -L/opt/local/lib -L/usr/local/lib
#include <stdio.h>
#include <errno.h>
#include <GeoIP.h>
//typedef GeoIP* GeoIP_pnt
*/
import "C"
import (
"log"
"os"
"unsafe"
)
// Set Quiet to tru... |
4c2ee423b3357f05374ac4ce980d05425301479f | 7587dbaaf6ebe8e91dae587f0c521a5b5de1a5be | vicever/go2o | /src/com/domain/interface/sale/sale.go | Go | go | 335 | permissive | /**
* Copyright 2014 @ ops Inc.
* name :
* author : newmin
* date : 2013-12-08 11:44
* description :
* history :
*/
package sale
type ISale interface {
GetAggregateRootId() int
CreateProduct(*ValueProduct) IProduct
// 根据产品编号获取产品
GetProduct(int) IProduct
// 删除商品
DeleteProduct(int) error
}
|
84dbe986c4931f0432d501091aae525c8f4dfeac | dafbbc0d318ab2de5c5f51bdc3abd7fa86217b4b | MoonFox0625/myAlgorithm | /basic/basic.go | Go | go | 527 | no_license | // Package basic :
// File: basic.go
// Date: 2021/1/19 15:06
// Desc:
package basic
import (
"math/rand"
"time"
)
// 生成n以内的含有size个数的随机正整数切片
func GenerateRandomSlice(size int, n int) []int {
slice := make([]int, size, size)
rand.Seed(time.Now().UnixNano())
for i := 0; i < size; i++ {
slice[i] = rand.Intn(n)
... |
7d99d8b79af13678e4bfdbbffbb49530641214e7 | 086d1b0c424d6a702d646dbc02f2ac38d154aa76 | dmaciel/linkerd2 | /test/edges/edges_test.go | Go | go | 5,199 | permissive | package edges
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"regexp"
"strings"
"testing"
"text/template"
"time"
"github.com/linkerd/linkerd2/testutil"
)
var TestHelper *testutil.TestHelper
func TestMain(m *testing.M) {
TestHelper = testutil.NewTestHelper()
os.Exit(testutil.Run(m, TestHelper))
}
// TestEdges ... |
5b7df44db87c4192458a018db1dcb5c4585515b8 | 5de1d63f1b78441f7ebc98cdaf5442d3493d2de9 | liubo0127/tiup | /cmd/cmd_test.go | Go | go | 747 | permissive | // Copyright 2020 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... |
e3756f501925c3776bee54ec528667c8f132da39 | 0969a84eed2d00f0094fa8e80731e4c2b0accf7a | fengjixuchui/hhvm | /third-party/thrift/src/thrift/compiler/test/fixtures/patch/gen-go_mstch/thrift/annotation/thrift/types.go | Go | go | 65,325 | permissive | // @generated by Thrift for [[[ program path ]]]
// This file is probably not the place you want to edit!
package thrift // [[[ program thrift source path ]]]
import (
"fmt"
scope "thrift/annotation/scope"
"github.com/facebook/fbthrift/thrift/lib/go/thrift"
)
var _ = scope.GoUnusedProtection__
// (needed to ... |
5d1e1116ccf5bfa0465c3ca8b1dbc3b780689c54 | 2cc5f1db73887b4054528334c3d381a80db18e47 | thithimos/min-api-go | /main.go | Go | go | 360 | no_license | package main
import (
"fmt"
"html"
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter().StrictSlash(true)
router.HandleFunc("/", Index)
log.Fatal(http.ListenAndServe(":8080", router))
}
// Index route
func Index(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello... |
a534a1199eb9d8efa35e9e3237154e8fc6162caa | 5d7e8bd05a794af4b7dc092acd46d31bdfd76b81 | abhinavsinha1991/covaccine-notifier | /notifier.go | Go | go | 545 | permissive | package main
import (
"net/smtp"
"strings"
)
func sendMail(age, dose, district, id, pass, body string) error {
msg := "From: " + id + "\n" +
"To: " + id + "\n" +
"Subject: " + strings.ToUpper(district) + " : DOSE" + dose + " Vaccination slots are available for age: " + age + "\n\n" +
"Vaccination slots are a... |
9adaf6ff46ba5426312921ec998d6ced581592f7 | 88f25b2ad4ed8efd87bf70ce0ac5237254aaec05 | vichar/romanNumeralReverse | /romanNumeralReverse_test.go | Go | go | 1,391 | no_license | package romanNumeralReverse_test
import (
"testing"
"github.com/vichar/romanNumeralReverse"
)
func Test(t *testing.T) {
t.Run("input number as string I should return int 1", func(t *testing.T) {
get := romanNumeralReverse.Parse("I")
want := 1
if want != get {
t.Errorf("It should say %d but get %d", want,... |
1bd7d97cb23bd68354ea66d7f11cba1144bcb908 | 2235970f589793819c2ada23228614503c0f66af | sysbot/go-ipfs | /routing/mock/dht.go | Go | go | 1,098 | permissive | package mockrouting
import (
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
sync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
mocknet "github.com/... |
2d35c712d3c4ca14628d5a0dba5dea70444ed60a | 3693f1270a3d2e1eb254d55d8094264816b89281 | ziutek/emgo | /egpath/src/stm32/examples/f4-discovery/mutex/main.go | Go | go | 1,045 | permissive | package main
import (
"delay"
"math/rand"
"rtos"
"sync"
"stm32/hal/gpio"
"stm32/hal/system"
"stm32/hal/system/timer/systick"
)
var leds *gpio.Port
const (
Green = gpio.Pin12
Orange = gpio.Pin13
Red = gpio.Pin14
Blue = gpio.Pin15
)
func init() {
system.Setup168(8)
systick.Setup(2e6)
gpio.D.Enab... |
f94cfc12595ea8b52d5d877a05998c69085258ce | 1cb058c6ab6c066a1c42cc15fc08669fbfa42c0d | mreza0100/free-society | /services/post/nats/subscribers.go | Go | go | 2,984 | no_license | package postNats
import (
"freeSociety/configs"
natsPb "freeSociety/proto/generated/nats"
"freeSociety/services/post/instances"
"github.com/mreza0100/golog"
"github.com/nats-io/nats.go"
"google.golang.org/protobuf/proto"
)
type subscribers struct {
srv instances.Sevice
lgr *golog.Core
nc *nats.Conn
}
func... |
22003b58fa181d884b3d25a2e5e05e52ce9ed618 | bc2277b612f532715bde46280be5037505576ed4 | krittawatcode/golangdoc | /src/Section_6_Data_Structure/21_slices/2_declare_slice/declare_slice.go | Go | go | 289 | no_license | package main
import "fmt"
func main() {
a := []int{1, 2, 3, 4}
s := a[1:3]
ss := make([]int, 5, 10) // make([]int, len, cap) or make([]int, len)
ss[6] = 99
fmt.Println(len(s), cap(s), s)
fmt.Println(len(ss), cap(ss), ss)
// panic: runtime error: index out of range
}
|
8337a4ca7a78d5684b89b1859cffe4ba18cafd61 | 32ec615016ab94ebc73eaacd9dd6351843ad6dd9 | jessfraz/docker | /daemon/inspect.go | Go | go | 9,412 | permissive | package daemon // import "github.com/docker/docker/daemon"
import (
"context"
"errors"
"fmt"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
networktypes "github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
"github.com/docker/dock... |
337981c9c7dc02bbbe1121b467b4d6a1bf89e980 | 99d731a0f0916ad7a1391ae0e7dd7a10ed0a9ea8 | lettfeti/atlas-gonnect | /addon.go | Go | go | 2,724 | permissive | package gonnect
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"path"
"runtime"
"text/template"
"github.com/craftamap/atlas-gonnect/store"
"github.com/sirupsen/logrus"
)
var LOG = logrus.New()
func init() {
// TODO: We should propably give the programmers more control about the logging... |
12a20d05d18a299b3364be57eea7181f0aaaf19b | 0a4fddac340d9c8bfe406d61b4200b943a0ca284 | zoosky/DistributedSagas | /sagas/saga.go | Go | go | 7,190 | permissive | package sagas
import (
"sync"
)
// Concurrent Object Representing a Saga, to allow for the concurrent execution of tasks
// Methods update the state of the saga.
type Saga struct {
id string
log SagaLog
state *SagaState
updateCh chan sagaUpdate
mutex sync.RWMutex
}
// Start a New Saga. Logs... |
2857f8e1add3295213b1c516bad66b2c7d07763f | 8b0b93498018389d4166cb2b473827f39abb495d | lwslws22222/onecloud | /pkg/multicloud/huawei/storagecache.go | Go | go | 9,987 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
18a865e277bb138b6deb3f1f3a8c2320c863aa28 | fed8662f5648727349d5cfc61c424873261338b6 | albertvaka/google-photos-api-client-go | /lib-gphotos/retries.go | Go | go | 1,722 | permissive | package gphotos
import (
"context"
"fmt"
"net/http"
"strconv"
"time"
"github.com/gphotosuploader/googlemirror/api/photoslibrary/v1"
"google.golang.org/api/googleapi"
)
func (c *Client) retryableMediaItemBatchCreateDo(ctx context.Context, request *photoslibrary.BatchCreateMediaItemsRequest, filename string) (*... |
c9e4bda49593b48c68ee40524e87f30765b0d8ab | 253d79b32a3eecb75744820dae1f14519841e93c | ks3sdklib/aws-sdk-go | /aws/credentials/static_provider.go | Go | go | 1,152 | permissive | package credentials
import (
"github.com/ks3sdklib/aws-sdk-go/internal/apierr"
)
var (
// ErrStaticCredentialsEmpty is emitted when static credentials are empty.
ErrStaticCredentialsEmpty = apierr.New("EmptyStaticCreds", "static credentials are empty", nil)
)
// A StaticProvider is a set of credentials which are ... |
fc10941ae12509f93eee2b899d5c9fe7aa2fee10 | 3a78f0d3394f32dcbc62d2912398efef4e1b93dd | Fox-Valentin/goLearn | /src/queue/123.go | Go | go | 232 | no_license | package queue
type Queue []interface{}
func (q *Queue) Push(v int) {
*q = append(*q, v)
}
func (q *Queue) Pop() int {
head := (*q)[0]
*q = (*q)[1:]
return head.(int)
}
func (q *Queue) IsEmpty() bool {
return len(*q) == 0
}
|
df4c7a8b42d2e69e5bf2fb36483c9f06d616004c | 95c328a6951a6e2c5858eddcc754e2ce40ea6494 | sgtest/monorepo-test-3 | /kubernetes-3/plugin/pkg/scheduler/algorithm/priorities/util/non_zero.go | Go | go | 2,303 | 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, ... |
6399187380c40115262c1c547542e0102b5169c7 | 59db283574e905f23fe65f6a712efec4bf4a354a | jinjintang/learningGo | /controllers/course_advertise.go | Go | go | 4,655 | no_license | package controllers
import (
"encoding/json"
"errors"
"qingguo-api/models"
"strconv"
"strings"
"github.com/astaxie/beego"
)
// CourseAdvertiseController operations for CourseAdvertise
type CourseAdvertiseController struct {
beego.Controller
}
// URLMapping ...
func (c *CourseAdvertiseController) URLMapping()... |
949e5b60980786e4f667fb48968379d22fb1b0b0 | 32a8bf0398d4b714337af8cd070dcd87cf57db2f | ifzz/janus | /cmd/server.go | Go | go | 2,721 | permissive | package cmd
import (
"context"
"github.com/hellofresh/janus/pkg/api"
"github.com/hellofresh/janus/pkg/errors"
"github.com/hellofresh/janus/pkg/opentracing"
"github.com/hellofresh/janus/pkg/server"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
// this is needed to call the init function on each pl... |
e9f0955563387b12b2e89887fd453427be07c2f6 | e70d51635a2dfe44a7c3e441b14a94d5c17aac72 | yinlingchaoliu/jvmgo | /go/src/main/native/java/util/concurrent/atomic/AtomicLong.go | Go | go | 254 | no_license | package atomic
import (
"main/native"
"main/rtda"
)
func init() {
native.Register("java/util/concurrent/atomic/AtomicLong", "VMSupportsCS8", "()Z", vmSupportsCS8)
}
func vmSupportsCS8(frame *rtda.Frame) {
frame.OperandStack().PushBoolean(false)
}
|
98a4a14564c1e063ffc1d5283937894c55f1bf8c | 14f93507a67443bee693975c0635e8315e113e75 | ohlinux/revel | /i18n.go | Go | go | 6,208 | permissive | package rev
import (
"fmt"
"github.com/robfig/goconfig/config"
"os"
"path"
"path/filepath"
"regexp"
"strings"
)
const (
CurrentLocaleRenderArg = "currentLocale" // The key for the current locale render arg value
messageFilesDirectory = "messages"
messageFilePattern = `^\w+.[a-zA-Z]{2}$`
unknownValueFor... |
a2d7bdea81548c244ae3af86966e76bb0b1de9ca | 7d70e3788e2b7a67131ecb2f89d2317b1c246e1c | ysh86/mpeg | /video/idct.go | Go | go | 5,053 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package video
// This is a Go translation of idct.c from
//
// http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testin... |
ac42fc45a15e50539c8391aa203f277e0e64ec10 | 2597855c372a6894f2378b96af782d6c9475e9b4 | mctofu/golang-expression-evaluation-comparison | /common.go | Go | go | 384 | no_license | package main
const example = `(Origin == "MOW" || Country == "RU") && (Value >= 100 || Adults == 1)`
func createParams() map[string]interface{} {
params := make(map[string]interface{})
params["Origin"] = "MOW"
params["Country"] = "RU"
params["Adults"] = 1
params["Value"] = 100
return params
}
type Params struc... |
138c86f122ace1c2a9e3a67a7911a6df673b2622 | 194d3a40ed74fbe15ddac9abad116f1aefd28e5e | geraldo-andrade/moneygo | /handlers/reports.go | Go | go | 2,971 | permissive | package handlers
import (
"github.com/aclindsa/moneygo/internal/models"
"github.com/aclindsa/moneygo/internal/reports"
"github.com/aclindsa/moneygo/internal/store"
"log"
"net/http"
)
func ReportTabulationHandler(tx store.Tx, r *http.Request, user *models.User, reportid int64) ResponseWriterWriter {
report, err ... |
19333d1a1f3cbbcc7fa51143177d7843e309d2c6 | daa7b5cba7a97e1cab1fa3ff14248014eaaec0bf | shyamalschandra/leabra | /deep/super.go | Go | go | 9,739 | permissive | // Copyright (c) 2019, The Emergent 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 deep
import (
"fmt"
"log"
"github.com/emer/leabra/leabra"
"github.com/goki/ki/kit"
"github.com/goki/mat32"
)
// BurstParams determine... |
72aaae1314dc29e176dc660acced38b4b269294f | 981359b5a50a0ad48675a30bc35fe4d69d560aa4 | shibosen/htgolang-20210313 | /homework/day12-20210704/GO4047-xiaowen/Webusermanage/main.go | Go | go | 334 | no_license | package main
import (
_ "webusermanage/routers"
"github.com/beego/beego/v2/server/web"
_ "github.com/go-sql-driver/mysql"
)
func main() {
// http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// http.Redirect(w, r, "/login/", http.StatusFound)
// })
// http.ListenAndServe(config.Addr, nil)
... |
08976389c0f327c20cf195327ecf2f479fab4d30 | c65ac5ecbca1fa1418f830519b3397dfd32c0b57 | rsharifnasab/twitter-backend | /handler/article.go | Go | go | 13,300 | permissive | package handler
import (
"errors"
"net/http"
"strconv"
"github.com/labstack/echo/v4"
"github.com/rsharifnasab/twitter-backend/model"
"github.com/rsharifnasab/twitter-backend/utils"
)
// GetArticle godoc
// @Summary Get an article
// @Description Get an article. Auth not required
// @ID get-article
// @Tags art... |
c4417d07ca75f5880eec8906b209ca39da7a0c03 | b1d108dfcf04ade8d7d63e3460ac9cc8d1dc9d49 | stoyanr/gardener-extension-provider-alicloud | /pkg/admission/validator/cloudprofile.go | Go | go | 2,352 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.