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 |
|---|---|---|---|---|---|---|---|---|
d2c68b01a7318fb33a7d716cb064b5cfb3194d67 | 27a6eb4c8379dc617ae2c75af7e52a81f03f74ff | simster7/argo | /test/e2e/estimated_duration_test.go | Go | go | 2,196 | permissive | // +build e2e
package e2e
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
wfv1 "github.com/simster7/argo/v2/pkg/apis/workflow/v1alpha1"
"github.com/simster7/argo/v2/test/e2e/fixtures"
)
type EstimatedDurationSuite struc... |
79541252f6d13b575f40516f734ef3c0101e9b84 | 49e2b12292c3626f5d643fabdc2c668d7d42882d | Seamroig/BUPT- | /vcoin-iteration5-3.25/blockchain.go | Go | go | 8,898 | no_license | package main
import (
"bytes"
"crypto/ecdsa"
"encoding/hex"
"fmt"
"log"
"os"
"github.com/boltdb/bolt"
)
const dbFile = "blockchain.db" //数据库文件名当前目录下面
const blockBucket = "blocks" //一个名称
const genesisCoinbaseData = "你们好"
type BlockChain struct {
tip []byte //二进制数据
db *bolt.DB //数据库
... |
ecc0fd18e0d01f312203a25c8651464bf94982b3 | 9c4f269ca5bfd3eb1ab2916f804fc1850213f0c7 | openshift/openshift-azure | /vendor/go.opencensus.io/metric/gauge_test.go | Go | go | 14,761 | permissive | // Copyright 2018, OpenCensus 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... |
271af84120ad62dcc1f18c8ada633d27f8262cd4 | 92f07f9e06714613bc534e223af15f89f52175f7 | torome/go-sso | /service/api/auth/cookie.go | Go | go | 1,586 | no_license | package auth
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/gorilla/sessions"
"go-sso/conf"
"go-sso/db/model"
"go-sso/pkg/log"
)
var store = sessions.NewCookieStore([]byte(conf.GetConfig().Common.AppSecret))
type cookieAuthManager struct {
name string
}
func NewCookieAuthDriver() *cookieAuthManager... |
2c93bed23a6ab78e9773e98ffaa05d3ec768731b | ebd1208a1b557d0b9bfd6eaac9cdbb52276bb07e | vivimouret29/pulumi-azure-native | /sdk/go/azure/network/v20190701/expressRouteGateway.go | Go | go | 8,810 | permissive |
package v20190701
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type ExpressRouteGateway struct {
pulumi.CustomResourceState
AutoScaleConfiguration ExpressRouteGatewayPropertiesResponseAutoScaleConfigurationPtrOutput `pulumi:"autoScaleConfiguration"`
E... |
6aea2e12ead2edef445c74f78b4aac7b6dc1d252 | 409b6208f76f6b2a5b1621785d5ef04cf3bafbcf | yarikoptic/gogs | /vendor/github.com/go-macaron/session/redis/redis.go | Go | go | 5,680 | permissive | // Copyright 2013 Beego Authors
// Copyright 2014 The Macaron Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless req... |
4b44063d5f24bee650c535b19436e58d8511137c | 75fcac3202e19cdf1cdbe68cf4027358d2e1809e | PacktPublishing/Hands-On-Restful-Web-services-with-Go | /chapter11/encryptClient/vendor/github.com/micro/go-micro/registry/cache/cache.go | Go | go | 7,933 | permissive | // Package cache provides a registry cache
package cache
import (
"math"
"math/rand"
"sync"
"time"
"github.com/micro/go-micro/registry"
log "github.com/micro/go-micro/util/log"
)
// Cache is the registry cache interface
type Cache interface {
// embed the registry interface
registry.Registry
// stop the cac... |
e055e6947c563d18db4b260e64a3da673e7e2329 | dd2ba5d1269c19200a4f39d0759d13c46ea440d6 | adambraimbridge/list-notifications-rw | /db/db.go | Go | go | 4,488 | permissive | package db
import (
"time"
"github.com/Financial-Times/list-notifications-rw/model"
log "github.com/sirupsen/logrus"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
var maxLimit int
var cacheDelay int
var expectedConnections = 1
var connections int
// Open opens a new session to Mongo
func (db *MongoDB) Open() (TX... |
2b120cf7e0e303b64fe445945c7e3da58033b729 | e607f0f62bef5ad8a2b1b2f3a156bfd679156af3 | FrankieFinancial/zap | /example_test.go | Go | go | 10,053 | permissive | // Copyright (c) 2016 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 Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
680e6e2b36da8ff061db3e072f133d84c58d0989 | f56e51d9f8008a138fc86dc8241616ee8e9aa125 | firmanJS/belajar-go-dasar | /v2/slice/example.go | Go | go | 285 | no_license | package main
import "fmt"
func main() {
mySlice := []int{1,2,3,4,5}
for i, v := range mySlice {
fmt.Println(i, v)
}
mySliceStr := []string{"Ali", "Depa", "Alfi", "Jojo", "Aneki"}
mySliceStr = append(mySliceStr, "Arya")
for _, v := range mySliceStr{
fmt.Println(v)
}
}
|
5c0144ab4030efaf32199d8a490280729ff0f8f6 | a69c4408991818a4eab02a1d3099f26baa35df7b | giiuser/wms | /vendor/modernc.org/ql/file2.go | Go | go | 21,590 | permissive | // Copyright 2018 The ql 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 ql // import "modernc.org/ql"
import (
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"modernc.org/db"
cfile "modernc.org/file"
"modern... |
e277cfed3f1b4ac8b16fef3da929065401def3fe | 8761e78ca6e8df80c61179da9dbac4cb1f1edbb9 | solution9th/NSBridge | /internal/utils/tools.go | Go | go | 1,065 | permissive | package utils
import (
"encoding/json"
"math/rand"
"time"
"github.com/satori/go.uuid"
)
const (
alphabetnum = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
tokenSize = 16
authKeySize = 16
authSecretSize = 32
)
func init() {
rand.Seed(int64(time.Now().Nanosecond()))
}
// GenToke... |
9f371c775c39343f4d4f5e9427ca1628a706ecb5 | f52943dbd76307e5593996357f9fc540d37f25bc | hcpss-banderson/twit | /params.go | Go | go | 1,407 | permissive | package main
import (
"encoding/json"
"io/ioutil"
"strings"
"gopkg.in/yaml.v2"
)
// TemplateParams is the representation of template parameters.
type TemplateParams struct {
flags []string
params map[string]interface{}
}
// String is the string representation of the TemplateParams.
func (tp *TemplateParams) ... |
661519d2eb92b6630b14dd0827b1a461d4354f8d | e713462b0ea3672d7fceccfec777257040a80934 | petesndrs/progspeed | /go/fibonacci_twoways/fib.go | Go | go | 482 | no_license | package main
import "fmt"
func rec_fib(n int) int {
if n==1 || n==2 { return 1 }
return rec_fib(n-1) + rec_fib(n-2)
}
func it_fib(n int) int {
var prev_sum int = 1
var sum int = 1
var tmp int
if n==1 || n==2 { return 1 }
for i:=3; i<=n; i+=1 {
tmp = sum
sum += prev_sum
prev_sum = tmp
}
return s... |
fdb203d50c52f97339888f219759b257f9c60afc | a3d18720bf3b89a11a372917369a5fab299597e6 | tilt-dev/tilt | /vendor/github.com/gdamore/tcell/terminfo/term_linux.go | Go | go | 1,855 | permissive | // Generated automatically. DO NOT HAND-EDIT.
package terminfo
func init() {
// linux console
AddTerminfo(&Terminfo{
Name: "linux",
Colors: 8,
Bell: "\a",
Clear: "\x1b[H\x1b[J",
ShowCursor: "\x1b[?25h\x1b[?0c",
HideCursor: "\x1b[?25l\x1b[?1c",
AttrOff: "\x1b[m\x0... |
230c26d6352b7716c697f6b1c908b3d2ef688da2 | 8e6ff653702ea8c290ab28a35c5d27036989f53a | harshmangalam/instagram-golang-server | /controllers/auth.controller.go | Go | go | 4,693 | no_license | package controllers
import (
"context"
"instagram/database"
"instagram/ent/user"
"instagram/utils"
"time"
"github.com/gofiber/fiber/v2"
)
func Signup(c *fiber.Ctx) error {
type FormData struct {
Name string
Username string
Password string
}
formData := new(FormData)
if err := c.BodyParser(form... |
0a228b4915bd62754573628d8d4c2f0abfe852da | d3d4661e3b15fb6948d3fb08cb1e9512fc4a1e41 | aerogear-attic/mobile-controller | /vendor/github.com/aerogear/mobile-crd-client/pkg/client/servicecatalog/clientset/internalversion/typed/servicecatalog/internalversion/fake/fake_servicebinding.go | Go | go | 5,514 | permissive | /*
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, ... |
9e8055679339789e7de633f3d35a761fedbca211 | 758d11117f64322e3ab74be9bddd805dba22a857 | jy19/amazon-ecs-init | /scripts/changelog/changelog.go | Go | go | 6,947 | permissive | package main
import (
"bufio"
"fmt"
"os"
"strings"
"time"
)
type Change struct {
Version string
Name string
Datetime time.Time
Changes []string
}
const (
CHANGE_TEMPLATE = "./CHANGELOG_MASTER"
TOP_LEVEL = "../../CHANGELOG.md"
AMAZON_LINUX = "../../packaging/amazon-linux-ami/ecs-init.spec"
... |
b5a26b1af82d0f0f0edebbb596e1a11b4785f05b | 4c9bf0661a641fb904d8ec455c0462285366834d | PetarTodorovv/compass | /components/director/internal/domain/label/repository.go | Go | go | 9,181 | permissive | package label
import (
"context"
"database/sql"
"fmt"
"strings"
"github.com/kyma-incubator/compass/components/director/pkg/resource"
"github.com/kyma-incubator/compass/components/director/pkg/apperrors"
"github.com/kyma-incubator/compass/components/director/internal/repo"
"github.com/kyma-incubator/compass... |
563a66f678c862dcee49310cfa25556d0e2ede48 | 926c25409b3a920274348d9e053d34f8d5cc8f7c | Mattlk13/oci-go-sdk | /identity/list_users_request_response.go | Go | go | 6,458 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
d9b59098939f9b01be5e07b7a5be78cc6c09833c | c9d3a9950cb992a60ecbf6327e2589fbbfccecdb | davidelena/antlr4-grammars | /tnsnames/tnsnamesparser_listener.go | Go | go | 19,961 | permissive | // Code generated from tnsnamesParser.g4 by ANTLR 4.7.2. DO NOT EDIT.
package tnsnames // tnsnamesParser
import "github.com/antlr/antlr4/runtime/Go/antlr"
// tnsnamesParserListener is a complete listener for a parse tree produced by tnsnamesParser.
type tnsnamesParserListener interface {
antlr.ParseTreeListener
//... |
9b98a5f9860c0ef2e6c12be7c4a5d2fd7df158d7 | 9aea233c3edd5e4302d834d7f5757c91eb635431 | stummalapally/Internet_security_project | /mirai/cnc/constants.go | Go | go | 2,723 | no_license | package main
const MiraiPrompt = `
Ü[1;41m±²[40mß[41m²±[0;31mÜ Ü[1;41m±²[1C²±[0;31mÜ Ü[1;41m±²[40m[A
[20C[40mß[41m²±[0;31mÜ Ü[1;41m±²[40mß[41m²±[0;31mÜ Ü[1;41m°±²[40m[A
[37C[41m²Û[6C[0;31mÜ[1;41m±²[40mß[41m²±[0;31mÜ Ü[1;41m±²[1C²[40m[A
[58C[41m±[0;31mÜ Ü[1;41m±²[1C[0;31mÜ[1;41m... |
9bfc19a60bf29366f0b81db7f35e66b045075881 | 2567a43697f80c6bdc8cade10e03992d0dca8f7d | alexrocco/k3s-pi-config | /internal/log/writer_test.go | Go | go | 2,226 | no_license | package log
import (
"bytes"
"fmt"
"testing"
"time"
"github.com/sirupsen/logrus"
)
func Test_Writer_Write(t *testing.T) {
type fields struct {
level logrus.Level
}
type args struct {
p []byte
}
tests := []struct {
name string
fields fields
args args
wantN int
wantErr b... |
a17aedaa73299d32d601b63820ed77b52dd487a2 | b5daa5255e523a9a6fb50c031d0541adcf642b0e | yoheimuta/gcache | /src/lib/index/index.go | Go | go | 1,742 | no_license | package index
import (
"fmt"
"log"
"strconv"
"sync"
"time"
"lib/config"
"github.com/garyburd/redigo/redis"
)
type Index struct {
mu sync.Mutex
conn redis.Conn
}
func getConfig() (timeout time.Duration, server string) {
rootConf := config.Instance().Root()
redisConf := rootConf["redis"].(map[interface{... |
87c3509d6092a7e757516bd35e5adffedbd559a0 | eeb7d1f5df9acbbed46e0b706629e04abf235c78 | sigtrap/teleport | /api/types/accesslist/convert/v1/accesslist_test.go | Go | go | 3,897 | permissive | /*
Copyright 2023 Gravitational, 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, soft... |
3d78f36e70c602d3ec0b67a16d6a9dfb32d9b570 | d63d68b271b2efa11e16b07cd9ff5ce86666f491 | pcaruana/origin | /vendor/k8s.io/kubernetes/test/e2e/storage/utils/utils.go | Go | go | 27,180 | 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, ... |
a42ebfccfc69394c70eaa30831c08ec57bca4771 | 16adcc07049c4c4c7aa187963ac6fffc893d7bd7 | ocxz/StudyGo | /GoCode/src/go_code/4_数组和切片/3、初识切片/demo02.go | Go | go | 361 | no_license | package main
import (
"fmt"
)
func main() {
// 演示切片的make创建使用
var slice []float64 = make([]float64, 5, 10)
fmt.Println(slice)
// 演示创建切片时,直接指定数组的方式
var strSlice []string = []string {"tom", "jack", "marry"}
fmt.Println(strSlice)
fmt.Println("len=", len(strSlice))
fmt.Println("cap=", cap(strSlice))
} |
a8b363c29120c246a273e633684a51eaac5a3d7c | 650553d3d529e66bf4840f893774c00ac938e62c | heaths/azure-sdk-for-go | /sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go_mod_tidy_hack.go | Go | go | 544 | permissive | //go:build modhack
// +build modhack
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of
// the resultant binary.
pack... |
446f7cc5522ae7515ca60c71f86bbb2c211335ef | 9d83f512f2a9036af1c8d87bd4b3b60267e28518 | aristanetworks/quantumfs | /backends/grpc/TestClient_test.go | Go | go | 6,162 | permissive | // Copyright (c) 2018 Arista Networks, Inc.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package grpc
// Mock test structures
import (
"fmt"
"sync/atomic"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
... |
7d0b5e9bcab49219edb56b18dd6a88f438f33dfb | 42affb79e814f48e388cd310b31d8459588d15aa | rayanebel/react-golang-todo-app | /server/middleware/db.go | Go | go | 1,600 | permissive | package middleware
import (
"fmt"
"log"
"path"
badger "github.com/dgraph-io/badger"
)
const (
DBRootPath = "/tmp"
DBFilename = "data.json"
DBBucketName = "todolist"
)
var Database *badger.DB
func InitBadgerDB() error {
fmt.Println("Init badger database...")
var err error
Database, err = badger.Open(b... |
2c5d0239e18986c172833b59524eae9fa60afef0 | 7155ef0ee202f9c096a4c4efaf3b5905486346c4 | ricmoreira/authentication | /services/user.go | Go | go | 2,100 | permissive | package services
import (
"authentication/models"
"authentication/models/request"
"authentication/models/response"
"authentication/repositories"
"authentication/util/errors"
"github.com/mongodb/mongo-go-driver/bson/objectid"
)
// UserServiceContract is the abstraction for service layer on roles resource
type Us... |
d4bf12e601263caaf86c668cb13ec474ae41e185 | ac6266f9aad6d6decdabac1b36447fcb5720be37 | nirasan/ast-walker | /lib/walk.go | Go | go | 8,716 | no_license | package ast_walker
import (
"fmt"
"go/ast"
"reflect"
)
type Visitor interface {
Visit(node ast.Node, history *History) (w Visitor)
}
func walkIdentList(v Visitor, list []*ast.Ident, history *History, name string) {
for i, x := range list {
Walk(v, x, history.AppendN(name, i), false)
}
}
func walkExprList(v ... |
18c5be7dfd58c30b4e407a7250df1c7aea3660e4 | 1e701db19f829e8840baa095d1b96c05c2425232 | znlstar/teleport | /lib/services/role_test.go | Go | go | 24,615 | permissive | /*
Copyright 2015 Gravitational, 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, soft... |
ca03a2a72ee083fc94ad66d4edc7fd5e1efef726 | d3333e1c79625d02aab52cd7ac549500f92c8776 | VineethReddy02/opentelemetry-go | /api/trace/current_test.go | Go | go | 2,795 | permissive | package trace_test
import (
"context"
"testing"
"time"
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/trace"
)
func TestSetCurrentSpanOverridesPreviouslySetSpan(t *testing.T) {
originalSpan := trace.NoopSpan{}
expectedSpan := mockSpan{}
... |
09a18623246b2a9dc6eecff158731dd9f9c6be8c | bc3cf185f89f4d1234c02b1de3acf6f14f403342 | forest-light/learning_golang | /online-playground/playground-tray.go | Go | go | 1,455 | permissive | package main
import (
"encoding/json"
"fmt"
"github.com/getlantern/systray"
"github.com/skratchdot/open-golang/open"
"io/ioutil"
"math/rand"
"online-playground/icon"
"os"
"time"
)
func main() {
systray.Run(onReady, nil)
}
type MenuItems struct {
MenuItems []MenuItem `json:"menu_items"`
}
type MenuItem s... |
7c91fc87251de83598035262ed09f435d382df89 | 23f7c79dc4519ae7ea9aae71f54e4f9173b4af6c | rkspx/go-simple-angular | /main.go | Go | go | 236 | no_license | package main
import (
"log"
"net/http"
)
const (
port = ":3000"
)
func main() {
fs := http.FileServer(http.Dir("public"))
http.Handle("/", fs)
log.Printf("serving on http://localhost%s/", port)
http.ListenAndServe(port, nil)
} |
44ccb816e1070a6c29b8a1685eeece941042df27 | cc319d96542da7d566a0ac650ca3aa5de2dfde4c | asvins/core | /models/prescription.go | Go | go | 1,103 | no_license | package models
import "github.com/jinzhu/gorm"
const (
PRESCRIPTION_FREQ_4H = iota
PRESCRIPTION_FREQ_6H
PRESCRIPTION_FREQ_8H
PRESCRIPTION_FREQ_12H
PRESCRIPTION_FREQ_24H
)
type Prescription struct {
Base
ID int `json:"id"`
TreatmentId int `json:"treatment_id"`
MedicationId int `json:"m... |
2fbdd1e090e1b4592b209b50a1102f3048c0435a | 82c37e7ac4387cc863d8f40569508441a3e1716e | wolviecb/codewars | /go/arrsubstrings/main_test.go | Go | go | 761 | permissive | package arrsubstrings
import (
"testing"
)
func testEq(a, b []string) bool {
// If one is nil, the other must also be nil.
if (a == nil) != (b == nil) {
return false
}
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}
func TestInArray(t *t... |
b19881bddb80e31b5ec4c75f017f7c56bb1df67c | d8425be5d0b9548d6fbc4c4fc66456b07b0e6473 | dickmao/gcsfuse | /benchmarks/stat_files/main.go | Go | go | 3,845 | permissive | // Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
c00f66a3a8558702d7a7d89c9e27541c7066af01 | 770b9eb2214c729715dab52588448f0d20068fde | kaspanet/kaspad | /app/rpc/rpc.go | Go | go | 6,371 | permissive | package rpc
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
"github.com/kaspanet/kaspad/app/rpc/rpchandlers"
"github.com/kaspanet/kaspad/infrastructure/network/netadapter"
"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/er... |
0a348682386ece21472c7d80d8d748b8e143f32c | 6d510fcd4a40fd37a8e7e5f86786309169ead788 | bimalkeeth/CookBook | /interfaces/interfaces.go | Go | go | 378 | no_license | package interfaces
import (
"fmt"
"github.com/lunny/log"
"io"
"os"
)
func Copy(in io.ReadSeeker,out io.Writer) error{
w:=io.MultiWriter(out,os.Stdout)
if _,err:=io.Copy(w,in);err!=nil{
return err
}
_,err:=in.Seek(0,0)
if err!=nil{
log.Error(err)
}
buf:=make([]byte,64)
if _,err:=io.CopyBuffer(w,in,bu... |
1490b1d9374b1891ca3d3e17d72e700bb10979c3 | 0642fabe20703d751aeb4acaa387dceac78dc52a | anstones/golang-space | /workspace/Interview/day14.go | Go | go | 362 | no_license | package main
import "fmt"
func incr(p *int) int {
*p++
return *p
}
func add(args ...int) int {
sum := 0
for _, arg := range args {
sum += arg
}
return sum
}
func main() {
str := "hello"
//str[0] = 'x' // 常量,Go 语言中的字符串是只读的,此处报错
fmt.Println(str)
p := 1
incr(&p)
fmt.Println(p)
fmt.Println(add(1, 3, ... |
0de4ce8c600cbd71aced6fb3c11d700e668e5a3b | 20326cddab76a531397d3ade6a43768f5020c666 | shishengsen/wechat-2 | /api/oplatform.go | Go | go | 16,353 | permissive | /*
* 纸喵软件
* Copyright (c) 2017~2020 http://zhimiao.org All rights reserved.
* Author: 倒霉狐狸 <mail@xiaoliu.org>
* Date: 2020/3/3 下午4:26
*/
package api
import (
"fmt"
"gitee.com/zhimiao/wechat/common"
"gitee.com/zhimiao/wechat/common/utils"
"gitee.com/zhimiao/wechat/models"
"gitee.com/zhimiao/wechat/req"
"git... |
c514eb8fd0439a351951fdbab932efc8670991cc | b45d55320ebfa5a7b778197046bd19493eb07b8f | pharmer/pharmer | /cloud/delete.go | Go | go | 5,647 | permissive | /*
Copyright The Pharmer Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
a36190742efa3069acb852953bf73617f4573606 | c3603d567b8b4a511724fe39ed8ad79a677a1e31 | gedex/go-talks | /pengenalan/slice-1.go | Go | go | 311 | no_license | // +build OMIT
package main
import (
"fmt"
)
// main START OMIT
func main() {
primes := [6]int{2, 3, 5, 7, 11, 13}
// Membentuk slice dari array
var s []int = primes[1:4]
fmt.Println(s)
// Mengubah slice s ikut mengubah array primes
s[0] = 4
fmt.Println(s)
fmt.Println(primes)
}
// main END OMIT
|
10edae17888ecc732a687a7115169ade3a57301b | 1edee3c8192135d06d8aa4461c603c97eebc0667 | phenixblue/perf-tests | /clusterloader2/pkg/tuningset/simple_tuning_set_factory.go | Go | go | 2,141 | permissive | /*
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, ... |
03871123becc67457ab40ee9a5bd6936ef35e5f6 | 1786d4311412e4e9356b3f2e0acd6855846bb8b8 | Tweoss/onos-cli | /pkg/cli/output.go | Go | go | 1,810 | permissive | // Copyright 2019-present Open Networking Foundation.
//
// 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... |
21f5b7392a8be9239f267ece52119db2fbc93aa5 | 46e957a856c2da3b084b8c62a39ffa2e2ae4d593 | Katano-Sukune/xpcutil | /amount.go | Go | go | 4,157 | permissive | // Copyright (c) 2013, 2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package xpcutil
import (
"errors"
"math"
"strconv"
)
// AmountUnit describes a method of converting an Amount to something
// other than the base unit of a litecoi... |
c7c52d0616ef92e14860afd05cd6d4c0814e229e | 09fdb38fd6f1cd46907ee737c9dd97e98298a0fa | mingrammer/notificator | /example/main.go | Go | go | 443 | permissive | package main
import (
"../../notificator"
"log"
)
var notify *notificator.Notificator
func main() {
notify = notificator.New(notificator.Options{
DefaultIcon: "icon/default.png",
AppName: "My test App",
})
notify.Push("title", "text", "/home/user/icon.png", notificator.UR_NORMAL)
// Check errors
err... |
b589b3182a7f7d90b3cb8b0a4ebe74631263714a | 558b8766409ab7f0b957671a68a3f0f0610acc64 | gravitational/wormhole | /vendor/golang.org/x/tools/internal/lsp/diagnostics.go | Go | go | 2,208 | permissive | // Copyright 2018 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 lsp
import (
"context"
"sort"
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
)
func (s *server) cacheAndDiag... |
6e9e450e7dce3b606af5ef86a780c77fa68d9e96 | 8eb5b4e3d7a63816ebbde299294373d1d81eea09 | deliahu/cortex | /pkg/lib/math/int.go | Go | go | 1,505 | permissive | /*
Copyright 2020 Cortex Labs, 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, softwa... |
610f88510c986fd54fae88d00dd9ae24638abcf0 | ed9de1498fc403508b703d83c0152089472de5bb | jdcloud-api/jdcloud-sdk-go | /services/jdw/models/DBInstanceAttribute.go | Go | go | 1,924 | permissive | // Copyright 2018 JDCLOUD.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 in ... |
c0633644ada2ea9460ccb1e7b3032e303bc9f2a0 | c019ad08186eb6901e7eff92281befee8984ccad | ihac/coredns | /plugin/file/setup.go | Go | go | 2,850 | permissive | package file
import (
"os"
"path/filepath"
"time"
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/parse"
"github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/mholt/caddy"
)
func init() {
caddy.RegisterPlugin("file", caddy.Plugin... |
28ccc51307dbf4a4c0c9530e5a708b2d22ee32f8 | 853eeb67b0f478c0280b3f8b510ba1dc61e857bf | kubernetes/kubernetes | /pkg/kubelet/server/stats/resource_analyzer.go | Go | go | 1,513 | 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, ... |
4af9aca55f3b83a654671dc21c6700fd2d336980 | 42537fc149488d0d814929029656572ee8a38e4b | FelixVicis/f15_advWeb_finalProject | /03_User_Accounts/model.go | Go | go | 484 | no_license | package main
/*
model.go by Allen J. Mills
CREATION: 11.17.15
COMPLETION: mm.dd.yy
This will serve as the file holding
the structures for our application.
*/
import "time"
type User struct {
Email string
UserName string `datastore:"-"`
Password string `json:"-"` // hash string
}
type blobbedIm... |
f37c679c3116fbc6b40466c9e6e1910372a61aba | 51b20fb67fbb8d27314c56e3be124d11d158701a | Mattlk13/oci-go-sdk | /tenantmanagercontrolplane/work_request.go | Go | go | 2,002 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
ea9cb34fb15c59c4c0ff5ad03eee0d065b51656d | c3442d29e2a7d8ed970d18441008ad817a8960b1 | vincent-pli/tekton-listener | /api/v1alpha1/eventbinding_types.go | Go | go | 3,250 | permissive | /*
Copyright 2019 vincent-pli.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
a90cd1c8697236659bec07d08c249f12e8a6220f | 0d7a3e8384c7c312b0023459133b3c7f1f40ddd8 | hcyray/gopbft-ubuntu | /datastruc/consensusmsg.go | Go | go | 7,969 | no_license | package datastruc
import (
"crypto/ecdsa"
"log"
)
type PrePrepareMsg struct {
Ver int
View int
Order int
Digest [32]byte
Pubkey string
Sig PariSign
}
type PrepareMsg struct {
Ver int
View int
Order int
Digest [32]byte
Pubkey string
Sig PariSign
}
type CommitMsg struct {
Ver int
View int
Order int
... |
dc5ca4a9d25fa1800bf18fc12b703251fd8e7fd2 | 620fb3c20b92d803215bfad089a1984224ee9dd0 | AlphaHat/sdc | /handler/AcceptAnswerHandler.go | Go | go | 600 | permissive | package handler
import (
"github.com/cinience/sdc/lib"
"github.com/cinience/sdc/model"
"strconv"
)
type AcceptAnswerHandler struct {
lib.AuthHandler
}
func (self *AcceptAnswerHandler) Get() {
aid, _ := self.GetInt64(":aid")
qid, _ := self.GetInt64(":qid")
uid, _ := self.GetSession("userid").(int64)
role, _ :... |
acaa60fa28bb5bb154813316549baadee978a404 | 76d47b21509879414b06b6b687b439d21ea12e0c | mimaken3/ShareIT-api | /infrastructure/user.go | Go | go | 11,136 | no_license | package infrastructure
import (
"errors"
"time"
"github.com/jinzhu/gorm"
"github.com/mimaken3/ShareIT-api/domain/model"
"github.com/mimaken3/ShareIT-api/domain/repository"
"golang.org/x/crypto/bcrypt"
)
type userInfraStruct struct {
db *gorm.DB
}
// DIのための関数
func NewUserDB(db *gorm.DB) repository.UserReposit... |
43c249b5447472ee60a979686ac0804c46012910 | acda1af773df3152b626dbd894c52a44be710496 | highsai-eng/garheeland | /main.go | Go | go | 2,324 | permissive | package main
import (
"log"
"os"
"github.com/garheeland/constant"
"github.com/garheeland/core"
"github.com/garheeland/handler"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
func main() {
defer log.Println("destroy garheeland...")
log.Println("starting garheeland...")
app := core.Applicatio... |
36fdd8b1eb6d0510860707769013b1a7560976c3 | 57311793f6f48d083e6e3eb23bd92d4ceec489fa | myleolei/leonet-gateway | /controllers/default.go | Go | go | 372 | no_license | package controllers
import (
"leonet-gateway/models"
"github.com/beego/beego/v2/client/orm"
beego "github.com/beego/beego/v2/server/web"
)
type MainController struct {
beego.Controller
}
func (ctx *MainController) Get() {
user := new(models.User)
var users []*models.User
orm.NewOrm().QueryTable(&user).All(&u... |
c278bde2a6dc7e1af89752980938aafd72098a38 | 40bd3dc235e6c457a35fd4cdfad3f5d55f1456ab | banzaicloud/pipeline | /internal/secret/types/type_google_test.go | Go | go | 2,466 | permissive | // Copyright © 2020 Banzai Cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
f58ebb290a054c0f8f974b9e58d257328381b2c8 | 525715bae6dc12461f7d0c12c598e23ed2a7e376 | projectcalico/calico | /felix/fv/latency_test.go | Go | go | 8,013 | 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 ... |
a459d7a16545ba3f9dca965a5caff09c9e04650d | f7e8e849f5ce0ceffd438586f4ba65bf7e7adf0e | yanweibing/sourcegraph | /enterprise/internal/insights/resolvers/insight_view_resolvers.go | Go | go | 9,446 | permissive | package resolvers
import (
"context"
"time"
"github.com/cockroachdb/errors"
"github.com/sourcegraph/sourcegraph/enterprise/internal/insights/store"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/segmentio/ksuid"
"github.com/graph-gophers/graphql-go/relay"
"github.com/sourcegraph/sourcegra... |
a98491e844be4019f9abca01c6feecf053cd6f0c | a84ae9a6a058b4226b642fe5555d06a0c1502953 | romanceresnak/fullstack-golang-react | /api/models/User.go | Go | go | 3,744 | no_license | package models
import (
"errors"
"github.com/badoux/checkmail"
"github.com/jinzhu/gorm"
"github.com/prometheus/common/log"
"golang.org/x/crypto/bcrypt"
"html"
"strings"
"time"
)
type User struct {
ID uint32 `gorm:"primary_key;auto_increment" json:"id"`
Nickname string `gorm:"size:255;not null;... |
34243394af3b54afa90fb3c1c3d6102a571f0853 | 695ff49cb4dd41684df48163dc92ddab4758a24b | microsoftgraph/msgraph-beta-sdk-go | /app/calls_item_participants_item_stop_hold_music_request_builder.go | Go | go | 5,151 | permissive | package app
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
i20a3050780ee0b0cde0a884a4f35429a20d6006... |
7f0e505a28c621fdc2baa7d14c9302d99f8d4068 | 607f6244e908dcbdf36514b297c19b79ec615f62 | meyskens/k8s-openresty-ingress | /vendor/github.com/modern-go/reflect2/tests/map_elem_array_test.go | Go | go | 1,492 | permissive | package tests
import (
"testing"
"github.com/modern-go/reflect2"
)
func Test_map_elem_array(t *testing.T) {
t.Run("SetIndex", testOp(func(api reflect2.API) interface{} {
obj := map[int][2]*int{}
valType := api.TypeOf(obj).(reflect2.MapType)
valType.SetIndex(obj, 2, [2]*int{(*int)(reflect2.PtrOf(1)), (*int)(r... |
eef1170cf876199a13b7a51e0b3011a4a3863059 | c4d6b3465a27a96bb13f552bbf9c6afa8b4d34da | shibayu36/go-Intern-Diary | /web/user_handler_test.go | Go | go | 2,740 | no_license | package web
import (
"net/http"
"testing"
"time"
"github.com/hatena/go-Intern-Diary/testutil"
"github.com/stretchr/testify/assert"
)
func TestServer_Signup(t *testing.T) {
app, ts := newAppServer()
defer ts.Close()
resp, respBody := client.Get(ts.URL + "/signup").Do()
assert.Equal(t, http.StatusOK, resp.S... |
26ba9d012fd840b994f3c5b4224c724572b4496a | 64879a10005d54db446a1badea00ce51659cb59f | yuexiaoyun/product | /routers/front/action_tool.go | Go | go | 1,872 | no_license | package front
import (
"helper/net/igin"
"github.com/gin-gonic/gin"
"tools"
"factory"
"helper/configs"
"helper/util"
"fmt"
)
type ToolAction int
var toolAction ToolAction
func (*ToolAction)GetAlbabaProductImages(c *gin.Context) {
param:=struct{
Url string `json:"url"`
}{}
gh:=igin.H(c)
if err:=c.BindJSO... |
1a8c0343ab4084d4b02bf055b86b38a9cf74bca9 | 7476064985c1e69ae481dd7cdd4595e26211941c | johnroyer/chtseg | /php-chtseg/php-chtseg.go | Go | go | 3,138 | permissive | package main
import (
"encoding/json"
"fmt"
"log"
"math/rand"
"os"
"regexp"
"strings"
"time"
"github.com/kitech/php-go/phpgo"
seg "chtseg/subs"
)
type structResult struct {
OrigInput string
UnsymInput string
Score float64
SegItems []string
NumWords uint
Guessed map[string]float64
}
var (
rest... |
3778c555b765b6410fa913b83da8116f1e5cda92 | bcef40ed2a3871c4ca0fee80b0a53bf4bbbbc2ff | mikekbnv/Leetcode-go-solutions | /partition_labels_763/solution_test.go | Go | go | 497 | no_license | package partition_labels_763
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_PartitionLables(t *testing.T) {
type args struct {
s string
}
tests := []struct {
name string
args args
want []int
}{
{
name: "partition lables",
args: args{
s: "ababcbacadefegdehijhklij",
},... |
5988076aa03f8baec941e0b8c589a1bd6b0b8fe0 | e675dad0773bb9a90e50e5e8280801bb23b5d6b3 | nobonobo/glfw | /browser.go | Go | go | 22,551 | permissive | // +build js
package glfw
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"runtime"
"github.com/gopherjs/gopherjs/js"
"golang.org/x/tools/godoc/vfs"
"honnef.co/go/js/dom"
)
var document = dom.GetWindow().Document().(dom.HTMLDocument)
var contextWatcher ContextWatcher
func Init(cw Cont... |
aaf0f7518783a94845b88c1c702e033605fe12f4 | 87647f7435ef66932b31316d793f3d3010959713 | pganalyze/collector | /setup/steps/li_ensure_supported_log_statement.go | Go | go | 1,654 | permissive | package steps
import (
"errors"
survey "github.com/AlecAivazis/survey/v2"
"github.com/pganalyze/collector/setup/state"
s "github.com/pganalyze/collector/setup/state"
"github.com/pganalyze/collector/setup/util"
)
var EnsureSupportedLogStatement = &s.Step{
ID: "li_ensure_supported_log_statement",
Kind:... |
50f680758a85f90b1ebfdeb9f484d2124add285c | 1a847cb3c17719172a7038eefb5f2a2b60732361 | himanshukandwal/trillian | /storage/cache/subtree_cache_test.go | Go | go | 15,314 | permissive | // Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
bc7a0b41a3f3ee3067c8ae000b2586d6ab4f0ba2 | 05e3c5dd2f9e4993269238ba8937234d91977e6d | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/signalrservice/v20200501/pulumiTypes.go | Go | go | 144,113 | 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 v20200501
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Network ACL
type NetworkACL struct {
// Allowed request types... |
3209f71cb00af0be06a149af0c8d50de2e8ccb62 | ef88a5b1b7b6739016d4e6ab3739fd7786fab8d7 | ranman/MATH-310-Project | /src/parallel.go | Go | go | 1,355 | no_license | package main
import "sync"
var optimize int = 25
func Merge(arr []int, group *sync.WaitGroup) {
if len(arr) < optimize && len(arr) != 1 {
InsertionSort(arr)
} else if len(arr) > 1 {
// Start at the midpoint
size := len(arr) / 2
left := arr[:size]
right := arr[size:]
// Perform sub-merges
group := ... |
0f7473c2e41a2cbd90adefcb8153a67deded51d4 | dfe8352d25f7cf6e2e3f75f587a6046a3a7d7234 | fossabot/federation-v2 | /pkg/client/listers_generated/federation/internalversion/federatedreplicaset.go | Go | go | 3,757 | permissive | /*
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, ... |
63b3c31e87b3c3b0874dcccf935f86d7e21b86e7 | 22457ff5c1564834c0752627ce494030895f94fb | caozg007/go_learning | /var/mutilvar.go | Go | go | 558 | no_license | /*
@Time : 2019-01-15 18:24
@Author : caozg
@File : mutilvar
*/
package main
var x, y int
var ( // 这种因式分解关键字的写法一般用于声明全局变量
A int = 2
B bool = true
)
var C, D int = 1, 2
var E, F = 123, "hello"
//这种不带声明格式的只能在函数体中出现
//G, H := 123, "hello"
func main() {
G, H := 123, "hello"
println(x, y, A, B, C, D, E, F, G, H)
... |
f5486ac55f58324443797adf027881408ed502f7 | 08847f95f08a99e89f79e26eb0c167c5221a55ec | zhuangel/gvisor | /pkg/tcpip/link/rawfile/rawfile_unsafe.go | Go | go | 4,814 | permissive | // Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
6bd588019bc60d73e1bd0d48ef8635f872efbed2 | fa5f04dad2f8da67af877abac754373428625ca3 | iinuwa/go-neb | /polling/polling.go | Go | go | 3,968 | permissive | package polling
import (
"runtime/debug"
"sync"
"time"
"github.com/matrix-org/go-neb/clients"
"github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/types"
log "github.com/sirupsen/logrus"
)
// Remember when we first started polling on this service ID. Polling routines will
// continually check... |
beceaec9886376e7779fd627ec11a130908e657e | 8089a76f2fec1816bf4d1fda8a6e52aed71b3715 | ajayr5/jx | /pkg/cmd/step/step_split_monorepo.go | Go | go | 9,718 | permissive | package step
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/jenkins-x/jx/pkg/cmd/opts/step"
"github.com/jenkins-x/jx/pkg/cmd/helper"
"github.com/jenkins-x/jx/pkg/cmd/opts"
"github.com/jenkins-x/jx/pkg/cmd/templates"
"github.com/jenkins-x/jx/pkg/gits"
"github.com/jenkins-x/jx/pkg/log"
"gi... |
dd84e7b1e6f79fa951f36ea91d2f2d05027038d3 | aa9dba3a3dcecf88c7c3b82bdaf19d0ca942bc6e | zeast/ftp | /parse_test.go | Go | go | 5,855 | permissive | package ftp
import (
"testing"
"time"
)
var thisYear, _, _ = time.Now().Date()
type line struct {
line string
name string
size uint64
entryType EntryType
time time.Time
}
type unsupportedLine struct {
line string
err string
}
var listTests = []line{
// UNIX ls -l style
{"drwxr-xr-x ... |
7bd4e7e49163aeae79e16491a15c6d38de93afea | 0eb5a9bd88f77d36ab4be756718674c3b2ddcd77 | fsamin/clide | /swift.go | Go | go | 1,348 | permissive | package main
import (
"github.com/graymeta/stow"
"github.com/graymeta/stow/swift"
"github.com/urfave/cli"
)
type swiftProvider struct{}
func (swiftProvider) name() string {
return "swift"
}
func (swiftProvider) description() string {
return "Openstack Swift Cloud Storage"
}
func (swiftProvider) flags() []cli.... |
7d9f450ccb259dcc23bc0520e5d8d7c7297ed946 | 361f51777f65d915c35321112f4fd79a241e53a3 | zeroberto/products-store | /users-data/datastore/sqldatastore/userInfoDataStoreSQL.go | Go | go | 1,818 | permissive | package sqldatastore
import (
"database/sql"
"github.com/zeroberto/products-store/users-data/datastore"
"github.com/zeroberto/products-store/users-data/driver/dbdriver"
"github.com/zeroberto/products-store/users-data/model"
)
const (
// QueryUserInfoByID represents a search query for UserInfo by ID in the base
... |
07d2f0595d725e1c370ecd0a8b458b78655d239e | a74414aafc6de2f5963b4985da4dfa3f21f593fa | fluid-cloudnative/fluid | /pkg/ddc/jindocache/master_internal.go | Go | go | 2,538 | permissive | /*
Copyright 2023 The Fluid 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, softw... |
8b76a18f60d577fbc0197a9f061d574defedbf94 | e438cc6c8b8bd5882b889967a0369cdc0b671cf5 | sweethomebot/go | /ui/v1/Charts.go | Go | go | 883 | no_license | package ui
type LineChart struct {
Type string
Title string
Scales int
FillLine bool
Labels []string
Lines []ChartItemLine
}
func NewLineChart(title string) LineChart {
return LineChart{Type: "chart_line", Scales: 1, FillLine: false, Title: title}
}
type ChartItemLine struct {
Type string
Co... |
8cf6ba4f109526d3986a487f1cc6f023ad2f5852 | 5533ed75391b6a9fd111cb13a53e2c30ac7c6a1c | alameddinc/golang-websocket-notification | /main.go | Go | go | 874 | no_license | package main
import (
"flag"
"fmt"
"log"
"net/http"
)
var addr = flag.String("addr", ":8080", "http server address")
var WS = NewWSServer()
func main() {
flag.Parse()
go WS.Run()
http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
ServeWs(WS, w, r)
})
http.HandleFunc("/coklu", func(w h... |
8d7f3c7d4c42b51a8ac65e7111db2b01f9500718 | 2c69502cf4091d89457db598b9fbd6413ac07f16 | thothonegan/btcwallet | /votingpool/pool_test.go | Go | go | 28,785 | permissive | // Copyright (c) 2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package votingpool_test
import (
"bytes"
"encoding/hex"
"fmt"
"reflect"
"testing"
"github.com/roasbeef/btcutil/hdkeychain"
vp "github.com/roasbeef/btcwallet/votingpo... |
345311991ddbb982e9fc841f05b9d7f72758f4cd | bcc2142c135992e8e953c09b4761a56d33e31c51 | iSteerApps/flogo-lib | /core/mapper/object.go | Go | go | 2,069 | permissive | package mapper
import (
"strings"
"github.com/TIBCOSoftware/flogo-lib/core/data"
"fmt"
"errors"
)
func MapObject(mappingObject interface{}, scope data.Scope, resolver data.Resolver) (result interface{}, err error) {
complexObject, ok := mappingObject.(data.ComplexObject)
if ok {
mappingObject = complexObjec... |
050cff9362d322b8855f1789de0451053e4adc52 | 90f1ebb1133066876808af958a0d1c3af8447b58 | paderlol/nerdctl | /pkg/eventutil/eventutil.go | Go | go | 1,432 | permissive | /*
Copyright The containerd 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... |
4d24d30307ee956fa1fd52223b2d3db38f045311 | 4a79d78f063483e067b66f9d72a3d19d09066e1a | ThyMYthOS/traefik | /vendor/github.com/snapcore/snapd/client/interfaces.go | Go | go | 5,174 | permissive | // -*- Mode: Go; indent-tabs-mode: t -*-
/*
* Copyright (C) 2016 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope tha... |
f64eb734663e3161e72addd0742a434acb691127 | 21a6db17def143ed45656da2c8c1f6202b622425 | yadavnikhil/gitops-engine | /pkg/sync/reconcile.go | Go | go | 3,482 | permissive | package sync
import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/types"
hookutil "github.com/yadavnikhil/gitops-engine/pkg/sync/hook"
"github.com/yadavnikhil/gitops-engine/pkg/sync/ignore"
"github.com/yadavnikhil/gitops-engine/pkg/utils/kube"
kubeutil "github.com/yadavnikhil/gi... |
d5e70be043661e8e03dd954842fb2b72aa4e851c | 4c3817bc670f2350f692e21d44c1659e756d2f7f | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/network/v20200801/getIpAllocation.go | Go | go | 1,980 | 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 v20200801
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// IpAllocation resource.
func LookupIpAllocation(ctx *pulumi.Context, args *LookupIpAll... |
24a82e708a21ab538c8888b41eaa566fe5206068 | b8d676a5b31ba53218de80b1207c7f2d44299ffb | kissthefire/fabric | /core/chaincode/lifecycle/metadata_provider_test.go | Go | go | 7,335 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package lifecycle_test
import (
cb "github.com/hyperledger/fabric-protos-go/common"
lb "github.com/hyperledger/fabric-protos-go/peer/lifecycle"
"github.com/hyperledger/fabric/common/chaincode"
"github.com/hyperledger/fabric/core/c... |
120718575b79b30b2279b5440784d0ec44e7eaa1 | 8d9103e09a062a45dc325290d2d6da737daadedd | liwilliamLL/goctl | /core/stores/mongo/pipe.go | Go | go | 1,881 | no_license | package mongo
import (
"time"
"github.com/globalsign/mgo"
"william/base/go-zero/core/breaker"
)
type (
// Pipe interface represents a mongo pipe.
Pipe interface {
All(result interface{}) error
AllowDiskUse() Pipe
Batch(n int) Pipe
Collation(collation *mgo.Collation) Pipe
Explain(result interface{}) er... |
2c9a8a04dff4f1dba77ff5723415918270513952 | 0e8baa49eb38c7c213cf7e2a1b6a6488b6ea8f7c | metamemelord/portfolio-website | /db/mongo.go | Go | go | 642 | no_license | package db
import (
"context"
"log"
"os"
"sync"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
var database *mongo.Database
var once sync.Once
func getDatabase() *mongo.Database {
once.Do(func() {
clientOptions := options.Client().ApplyURI(os.Getenv("MONGO_URI"))
mongoC... |
919a2652056e077de6e4e037a73ffa4b77115d17 | f74b57054a83eb2053a639e604d01b6c1585235e | RegatteBzh/dataLoader | /database/redis.go | Go | go | 348 | no_license | package database
import (
"github.com/spf13/viper"
redis "gopkg.in/redis.v4"
)
// Open create a redis client
func Open() *redis.Client {
return redis.NewClient(&redis.Options{
Addr: viper.GetString("redis_host") + ":" + viper.GetString("redis_port"),
Password: viper.GetString("redis_password"),
DB: ... |
63d3eb47d7b42f0ca3ec7a1ad3d7bb166d73bcdf | 77f17f5e2e2491166f77c684e44831f4cd3d7b77 | ChandleWEi/dns | /labels_test.go | Go | go | 1,371 | permissive | // Copyright 2011 Miek Gieben. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dns
import (
"testing"
)
func TestCompareLabels(t *testing.T) {
s1 := "www.miek.nl."
s2 := "miek.nl."
s3 := "www.bla.nl."
s4 := "nl.www.bla."
s5 :=... |
924427cb8d3f40e30e211976ce0cf2c3b3d9fd60 | bcd40e9b42c24862b3ee2ffada592c6a1f604bcd | qcbit/scratchpad | /go/lance/stdlibcookbook/chapter05/recipe11/zip.go | Go | go | 862 | no_license | // Reading/Writing ZIP files
package main
import (
"archive/zip"
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"os"
)
func main() {
var buff bytes.Buffer
zipW := zip.NewWriter(&buff)
f, err := zipW.Create("newfile.txt")
if err != nil {
panic(err)
}
_, err = f.Write([]byte("This is my file contents"))
if err !=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.