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 |
|---|---|---|---|---|---|---|---|---|
4c7b8c150c576ae11db8e1bb5585eada40ff2b6b | fb304daef3ce09cbf82fa17a5cae024ce0dfefa8 | incognito-core-libs/gozilliqa-sdk | /transaction/transaction_test.go | Go | go | 684 | no_license | package transaction
import (
"github.com/incognito-core-libs/gozilliqa-sdk/provider"
"testing"
)
func TestTransaction_TrackTx(t *testing.T) {
provider := provider.NewProvider("https://dev-api.zilliqa.com/")
tx := Transaction{
ID: "",
Version: "",
Nonce: "",
Amount: "",
GasPri... |
4a3653adbc1198eefa7b39a0d2851b94e13179fd | 3fb46726e7a49cb49adc1e8809f272d24efde681 | AlenaFedyaeva/go-architecture | /homework7/main.go | Go | go | 1,537 | no_license | package main
import (
// "homework2/notification"
"homework2/notification"
"homework2/repository"
"homework2/service"
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
var tokenStr string="1681252822:AAFl6JcfxHnypU-xwWL13rYIeUIc2uHX2s4"
// flag.StringVar(&tokenStr, "t", "", "token for telegram api")... |
22529f1d83c19ad690bb0e899af69cb3b63a040d | 3430094d1bca0e34572cc1be587d8bcf873ac1c1 | aboglioli/big-brother-old | /infrastructure/errors/errors_test.go | Go | go | 1,616 | no_license | package errors
import (
rawErrors "errors"
"testing"
"github.com/aboglioli/big-brother/pkg/errors"
"github.com/aboglioli/big-brother/pkg/tests/assert"
)
func stackErrors() (error, *errors.Internal, *errors.Validation, *errors.Status) {
err := rawErrors.New("Inner error")
internalErr := errors.NewInternal("INTE... |
b861c7cde6d9c88c8da0c5af5c4ce0922443001c | 5176cad7ebcde8e7892aee5617e696ea2f4ef683 | Corrots/greeting | /api/api.go | Go | go | 3,703 | no_license | package api
import (
"bytes"
"crypto/tls"
"encoding/json"
"github.com/PuerkitoBio/goquery"
"io"
"log"
"net"
"net/http"
"time"
)
// Create a http client
func createClient() *http.Client {
transport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
DialContext: (&net.Dialer{
T... |
9285beff0966b05d243da9eee21c6a37170f63bf | c2588c36580f2708f86c0ea9fd4c33c26c78e5a5 | zeebo/tdigest | /summary.go | Go | go | 3,534 | permissive | package tdigest
import (
"fmt"
"math"
"sort"
)
type summary struct {
means []float64
counts []uint32
bitree fen
}
func newSummary(initialCapacity uint) *summary {
s := &summary{
means: make([]float64, 0, initialCapacity),
counts: make([]uint32, 0, initialCapacity),
bitree: fen{buf: make([]uint32, init... |
f28f6431a2a795fcaaa7fbdc095914107ef5dec7 | a6011ce2adecfe3cf58c78a5f061b1e6e6b47ec7 | FeiWuTong/cypherBFT | /tests/block_test.go | Go | go | 1,669 | permissive | // Copyright 2015 The go-ethereum Authors
// Copyright 2017 The cypherBFT Authors
// This file is part of the cypherBFT library.
//
// The cypherBFT library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundat... |
323c66eebace7552018e857d29356a22b43a59f1 | 2d65ae7ea5b160c13c710177f200724eeea0278f | cataliniordache/ndn-dpdk | /dpdk/ethdev/ethdev.go | Go | go | 7,433 | permissive | package ethdev
/*
#include "../../csrc/dpdk/ethdev.h"
*/
import "C"
import (
"fmt"
"net"
"strconv"
"sync"
"unsafe"
"github.com/usnistgov/ndn-dpdk/core/macaddr"
"github.com/usnistgov/ndn-dpdk/dpdk/eal"
"github.com/usnistgov/ndn-dpdk/dpdk/pktmbuf"
"github.com/usnistgov/ndn-dpdk/dpdk/ringbuffer"
)
// EthDev re... |
5f19c3bb79a842e49991c2d87212ae8dd2cb127a | 578014c7dbb69a21cd8a32f3764540b434d48d3b | glcj/plc4x | /plc4go/spi/model/DefaultPlcReadRequestResult.go | Go | go | 1,357 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
97c5e5cf8d5463a4439d6605d4221809975222d7 | 20659e71554d6f2524e832422ed3f4f58fbd0eb6 | DeniesKresna/ecommerceapi | /Models/Inventory.go | Go | go | 1,805 | no_license | package Models
import (
"time"
"gorm.io/gorm"
)
type Inventory struct {
gorm.Model
Name string `json:"name"`
ImageUrl string `json:"imageUrl"`
ProcurementDocUrl string `json:"procurementDocUrl"`
StatusDocUrl string `json:"statusDocUrl"`
Nup uint `json:"nup"`
Year ... |
202a25b2f2c25e9b62a6bfd80d0e5884113d6795 | a702cd0c9543ce33ee6e01399068a45944272cd5 | mehderilker/Golang_Control_Web_Site | /vendor/models/page.go | Go | go | 721 | no_license | package models
import "html/template"
type SimplePage struct {
Title string
Description string
Abouts template.HTML
Category []Part
GirisYapmismi bool
}
type Home struct {
Page SimplePage
FileName string
Status bool
Response Response
PostOlduMu bool
User User
}
type Part struct {
Category string
PageSl... |
e81abac3e821b68e6fad48f57ef9e1fd428adfff | 358a76f32b1e78a9e1f5caeb37e9473e2bc021f9 | haishuokQAQ/golang-skeleton | /generators/db_access/db_access_generator.go | Go | go | 4,688 | no_license | package db_access
import (
`bytes`
`fmt`
`github.com/haishuokQAQ/golang-skeleton/database`
`github.com/haishuokQAQ/golang-skeleton/utils`
`strings`
`text/template`
`time`
)
type DBAccessConfig struct {
DalPath string
DBType string
ORM string
ORMVersion string
... |
ac86381ae2ebb0f1e9029c52d0176b48f3009771 | d26f68f308eec26a73a1a77a682dad9c692a798e | the-redback/contrib | /rescheduler/vendor/k8s.io/autoscaler/cluster-autoscaler/utils/gpu/gpu.go | Go | go | 5,471 | 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, ... |
6148d72b703f6e987cabde1484bf38e376cb4292 | f764bc9533fbccca9dac762ef827ef6f0cbfc349 | thanhnguyennguyen/incognito-chain | /blockchain/params.go | Go | go | 7,552 | permissive | package blockchain
import (
"time"
"github.com/incognitochain/incognito-chain/common"
)
type SlashLevel struct {
MinRange uint8
PunishedEpoches uint8
}
/*
Params defines a network by its component. These component may be used by Applications
to differentiate network as well as addresses and keys for one ... |
847b0abd62fa631bda318b37a5154a5db9cd8c5a | 84f7ec87273c22af9b547f88ed33ac80f6bd6802 | freelancer/mongodb_exporter | /collector/mongod/locks.go | Go | go | 3,388 | permissive | // Copyright 2017 Percona LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
262eb47cfc0ed5506c78ce9b8401e7bd4599143b | 26464f47715fcdce64c8d0f490007237c6b3e5bc | patino8308/twittor | /bd/modificoRegistro.go | Go | go | 1,160 | no_license | package bd
import (
"context"
"time"
"github.com/patino8308/twittor/models"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)
/*ModificoRegistro de un usuario*/
func ModificoRegistro(u models.Usuario, ID string) (bool, error) {
ctx, cancel := context.WithTimeout(context.Backgro... |
0f50513458ae5cc3f1f05b9b059a45ea34411f0d | fc9e21929d25a8db517fd7fc84f6ed99d7bcc06a | tobyclemson/gorgon | /config/main.go | Go | go | 1,279 | permissive | package config
import (
"github.com/spf13/cobra"
"github.com/tobyclemson/gorgon/git"
"github.com/tobyclemson/gorgon/ssh"
"path/filepath"
)
func ensureAbsolute(path string) (string, error) {
if filepath.IsAbs(path) {
return path, nil
} else {
return filepath.Abs(path)
}
}
func GithubToken(cmd *cobra.Comman... |
bd218861d1c7813d01203d8336f738b6371c8a23 | 97e97fd964852c59d512938b778ec776dec25aec | NinoMaj/go-by-example | /src/defer.go | Go | go | 771 | no_license | // Defer is used to ensure that a function call is performed later in a program’s execution, usually for purposes of cleanup. defer is often used where e.g. ensure and finally would be used in other languages.
package main
import (
"fmt"
"os"
)
func main() {
f := createFile("/tmp/defer.txt")
defer c... |
d603404c946b452eadce107e8661288021bc09b8 | e8dedf99646f724e0be154bc8e8113e045c462bd | avatarcop/youtube_golang | /unit-test/service/category_service_test.go | Go | go | 1,143 | no_license | package service
import (
"testing"
"unit-test/entity"
"unit-test/repository"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
var categoryRepository = &repository.CategoryRepositoryMock{Mock: mock.Mock{}}
var categoryService = CategoryService{Repository: categoryRepository}
func TestCa... |
989114fba9ae9241aee344b1e7a1b970a9cd0c3d | d742b0f60ad8e997bd1ae046f8404e3f6c94de35 | csy1997/go-study | /day1/11_浮点型.go | Go | go | 206 | no_license | package main
import "fmt"
func main() {
var f1 float32
f1 = 3.14
fmt.Println("f1 =", f1)
//自动推导类型
//默认是float64,比float32更准确
f2 := 3.14
fmt.Printf("f2类型%T\n", f2)
}
|
47a27fd3fbcd6a72f2b0f4aeb8aa62caa0c431e5 | a527c21651ba6aa283421645b526c0b2311f83b3 | knoebelja/generic-tool | /internal/read.go | Go | go | 521 | permissive | package internal
import (
"encoding/json"
"io/ioutil"
"gopkg.in/yaml.v2"
)
func readYAML(filepath string, v interface{}) {
data, err := ioutil.ReadFile(filepath)
check(err, "reading JSON from %s", filepath)
err = yaml.Unmarshal(data, v)
check(err, "storing %s in %+v", string(data), v)
}
func readJSON(filep... |
6693b1edadde735f4dd5d3b85d2400feea28c882 | 0b85f55f1f9e834422b78bf23f8233a22f4d40b6 | kevindong/aoc2020 | /template.go | Go | go | 281 | no_license | package main
import (
"fmt"
"io/ioutil"
"strings"
)
func readInput(file string) []string {
data, err := ioutil.ReadFile(file)
if err != nil {
panic(err)
}
return strings.Split(string(data), "\n")
}
func main() {
lines := readInput("sample.txt")
fmt.Println(lines)
}
|
cca952199e27773e08c3e1ddf738711b575a86cc | 5c2a8fb999f6d3aeb04b78fd19a4a4cae7fb0673 | nathankidd/aoc2018 | /03/3a2.go | Go | go | 1,149 | no_license | package main
import "fmt"
import "os"
import "bufio"
type Rect struct {
id int
x int
y int
width int
height int
}
func main() {
file, err := os.Open("input")
if err != nil {
panic(err)
}
defer file.Close()
var fab Rect
var claims []Rect
scanner := bufio.NewScanner(file)
for scanner.Sca... |
e8d2297374e560a913fd57b5e01ba3d994feed64 | 9322618a0d6fa17398158f4368b5da3f61647285 | DataDog/datadog-agent | /pkg/collector/corechecks/cluster/ksm/customresources/node.go | Go | go | 4,363 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
//go:build kubeapiserver
package customresources
import (
"context"
... |
0fa1db483ee31b41d47e967e14b495eb2e68c596 | f05ba129d8c81eeed9662ae95f3a1dd7d14ed2e9 | JohnStarich/go | /gopages/internal/flags/flags_test.go | Go | go | 1,164 | permissive | package flags
import (
"flag"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestParse(t *testing.T) {
t.Parallel()
args, output, err := Parse("-help")
assert.Equal(t, Args{
OutputPath: "dist",
}, args)
assert.NotEmpty(t, output)
assert.Equal(t, flag.ErrHelp, ... |
f431077c42dcbbb6f6d633b21a3e738d63b2ef25 | 2c66b4af4d930b51ce5665aee21cb9f9fb51136a | nazufel/golang-web-dev-course | /hands-on/02-template-composition/05-parse-csv/main.go | Go | go | 2,329 | no_license | package main
import (
"encoding/csv"
"html/template"
"log"
"net/http"
"os"
"strconv"
"time"
)
type Record struct {
Date time.Time
Open float64
High float64
}
func main() {
// define route to execute foo()
http.HandleFunc("/", foo)
// start the server
http.ListenAndServe(":8080", nil)
}
// Foo method
f... |
a682ce63a077842e269d80b429041cefdee163b2 | 5cea0ce48d4fd35436b6fdea9abb8f98870a9d26 | keithc-ca/odo | /vendor/github.com/devfile/library/v2/pkg/devfile/parser/context/apiVersion.go | Go | go | 2,177 | permissive | //
// Copyright 2022 Red Hat, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
18ac7c2ee63a2f05f7d78cbfeefa58cef4e0f02a | 3d744982cddbc526487b2991d0a394ef859c4898 | saimohanreddyt/gin-gonic | /tester.go | Go | go | 587 | no_license | package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
url := "http://localhost:8080/videos"
method := "GET"
payload := strings.NewReader(``)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("A... |
a284a91703e1c2a3df585409d03e59e817416ac9 | 108fd4114c5a0346d3f169e2db5e8652ab3e0057 | inkyblackness/deck | /src/github.com/inkyblackness/shocked-client/ui/AbsoluteAnchor.go | Go | go | 426 | permissive | package ui
type absoluteAnchor struct {
value float32
}
// NewAbsoluteAnchor returns an anchor with a determined value.
// Requests to set a new value are directly applied.
func NewAbsoluteAnchor(value float32) Anchor {
return &absoluteAnchor{value: value}
}
func (anchor *absoluteAnchor) Value() float32 {
return ... |
5306bc8e10fd15a16d03872337d61df6bd7d0ca5 | 188b3b56044768b1411735b96f36479d42c4359f | jatinssaluja/lorawan-stack | /pkg/identityserver/store/client.go | Go | go | 6,010 | permissive | // Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
c896887372b4d5e89a6884348bc44a7fcee60832 | 296dee2cb21a5e2a472e5092f24de116c0936815 | MisinformedDNA/pulumi-azure-nextgen | /sdk/go/azure/network/v20180401/routeTable.go | Go | go | 9,010 | 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 v20180401
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Route table resource.
type RouteTable struct {
... |
4fa4a9da874157897d84a878db3bffc9fd102333 | 0d63faeb37f7f505de415152829a6796b1fe6343 | aerogear-attic/app-metrics-operator | /pkg/utils/utils.go | Go | go | 2,164 | permissive | package utils
import (
"fmt"
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
"os"
"strings"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
)
const (
// AppNamespaceEnvVar is the constant for env variable AppNamespaceEnvVar
// which is the namespace where the APP CR can applied.
// The namespa... |
dd5788bb10f507917e514487db34251bfb30be5b | 2348423fbd4dd4295b37df4f5472a914b7c74853 | cmceniry/gotutorial-2014 | /commands/file/file.go | Go | go | 661 | no_license | package main
import "github.com/cmceniry/gotutorial/mapping" // (1)
import "bufio"
import "fmt"
import "os"
import "regexp"
var subs = map[string]string{}
func substitute(before string) string {
for needle, sub := range subs {
if re, err := regexp.Compile(needle); err == nil {
before = re.ReplaceAllString(befo... |
679eaa7be1e702307e3c3945fe12a1b928cee438 | d2f0ac905f0b9713d22b3b57490cecfdacf13a53 | torarnv/go-ipfs | /test/bench/offline_add/main.go | Go | go | 1,631 | permissive | package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"testing"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-random"
"github.com/ipfs/go-ipfs/repo/config"
"github.com/ipfs/go-ipfs/thirdparty/unit"
)
func main() {
if err := compareResults(); err != nil {
log.Fatal(err... |
847a83de632b3b3275d28b79440ec9b17e2fa878 | ccc17392ee0dc707cdde15552e7c457f44b12b19 | xiangsikai/kubernetes | /staging/src/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission_test.go | Go | go | 13,679 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
cd1b278eb4b7e90946fd338775c4ef861f460a2b | b080a3e53fdb0f2225947d8e27becae3165d376d | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/network/v20181201/loadBalancer.go | Go | go | 16,995 | 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 v20181201
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// LoadBalancer resource
type LoadBalancer struct {... |
19e1c890f47dcbeb5f7759dec7f3f37f989150be | df68bf1b00619db637153f7df388c7021ad5a365 | twkun/vitess | /go/vt/vttablet/tabletserver/tabletserver.go | Go | go | 56,306 | permissive | // Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tabletserver
import (
"fmt"
"io"
"math/rand"
"net/http"
"strings"
"sync"
"time"
log "github.com/golang/glog"
"golang.org/x/net/context"
"githu... |
6fe46764c86967d3f03558092be54e480022431d | 14193ddb4e1c2b8670c77f522a71bb00eadfbd17 | andremarianiello/buf | /internal/buf/cmd/buf/buf_test.go | Go | go | 12,389 | permissive | // Copyright 2020 Buf Technologies Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
de24b7c36520f4aee69ea1af7ad17c4421fc0c1c | 27231cf3110c06c78ee277a2bc8f8981f790018f | yatwql/ipfs-cluster | /cmdutils/configs.go | Go | go | 11,597 | permissive | package cmdutils
import (
"fmt"
"os"
"path/filepath"
"github.com/pkg/errors"
ipfscluster "github.com/ipfs-cluster/ipfs-cluster"
"github.com/ipfs-cluster/ipfs-cluster/allocator/balanced"
"github.com/ipfs-cluster/ipfs-cluster/api/ipfsproxy"
"github.com/ipfs-cluster/ipfs-cluster/api/pinsvcapi"
"github.com/ipfs... |
5297e1142c2f1e95220a8bb290d398d9a17e9796 | ff00c3588f9c785d0853624a01af09db36cc6d9d | lizhenggan/TwentyFour | /01_Language/01_Functions/go/src/functions/preg_match_all.go | Go | go | 554 | permissive | package functions
import (
"regexp"
)
func PregMatchAll(pattern string, subject string, matches *[][]string) bool {
compile, err := regexp.Compile(pattern)
if err != nil {
return false
}
matchList := compile.FindAllStringSubmatch(subject, -1)
if len(matchList) == 0 {
return false
}
if matches == nil {
m... |
7465c90ea35bbc98af8068bd81e5e9f8c862f1f5 | f9a19e179e61e6cb075aafb5086353bb3dd4255b | hellopyj/goim | /internal/logic/dao/redis.go | Go | go | 7,524 | permissive | package dao
import (
"context"
"encoding/json"
"fmt"
"strconv"
"github.com/Terry-Mao/goim/internal/logic/model"
log "github.com/golang/glog"
"github.com/gomodule/redigo/redis"
"github.com/zhenjl/cityhash"
)
const (
_prekey="Goim:"
_prefixMidServer = _prekey+"mid:%d" // mid -> key:server
_prefixKeyServ... |
796f5734a9f26720c6e20eb6a651972373fc516c | acaaaeed470f8fb7d2ddde157bbc05c0c7327ae5 | syrusakbary/goleveldb | /manualtest/dbstress/main.go | Go | go | 16,132 | permissive | package main
import (
"crypto/rand"
"encoding/binary"
"flag"
"fmt"
"log"
mrand "math/rand"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"path"
"runtime"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/syrusakbary/goleveldb/leveldb"
"github.com/syrusakbary/goleveldb/leveldb/errors"
"g... |
dc02fbc19b13358442b2307267fd757e322212a6 | 37c4826256891d71eda9ca4560a9fa4d38766173 | kadekchrisna/tiket | /src/infrastructures/repositories/v1/datasources/location.go | Go | go | 964 | no_license | package datasources
import (
"errors"
"fmt"
"gorm.io/gorm"
"tiket.vip/src/domains"
)
type LocRepos struct {
db *gorm.DB
}
func NewLocRepo(db *gorm.DB) domains.LocRepo {
return &LocRepos{
db: db,
}
}
func (r *LocRepos) GetLocation(id string) (*domains.Location, error) {
var loc domains.Location
if err :=... |
5b147f4705d30ffe9c9811c18b2eee576412956f | f49d8c5d186737440f0bd42e1f1f28da0abcf3c4 | tverney/gocommerce | /api/errors.go | Go | go | 3,437 | permissive | package api
import (
"context"
"fmt"
"net/http"
"os"
"runtime/debug"
gcontext "github.com/netlify/gocommerce/context"
)
func badRequestError(fmtString string, args ...interface{}) *HTTPError {
return httpError(http.StatusBadRequest, fmtString, args...)
}
func internalServerError(fmtString string, args ...int... |
a029281c1455b280801223001d6361bb43efbe7d | f389653ea46fed1da477d4f94ee5a54c8698145f | cebor/kubeone | /pkg/cmd/root.go | Go | go | 3,207 | permissive | /*
Copyright 2019 The KubeOne Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
f0fede6f7b9c36ea660797877bde46032a3bdc63 | 7592d0a7e3e11983c18867c276aea25eb91b702e | sl7xman/learn_algorithm | /sort/go/bubble.go | Go | go | 407 | no_license | package main
func bubble_int_standard(arr []int){
var n=len(arr)
var is_swap=false
for i:=0; i<n; i++{
is_swap=false
for j:=0; j < n-i-1; j++{
if(arr[j] > arr[j+1]){
tmp := arr[j]
arr[j]=arr[j+1]
arr[j+1]=tmp
is_swap=true
... |
64f3cd2aaa967dc44f7c0faeb054614a39733d22 | a8f26c652a7adaf1833227f0b530975e90200699 | magiclz233/go_learning | /go_base/ch12_interface_base/interface_test/interface_test.go | Go | go | 2,223 | no_license | package interface_test
import (
"fmt"
"math"
"testing"
)
type Programmer interface {
WriterHelloWorld() string
}
type GoProgrammer struct {
}
func (g *GoProgrammer) WriterHelloWorld() string {
return "fmt.Println(\"Hello World\")"
}
func TestClient(t *testing.T) {
var p Programmer
p = new(GoProgrammer)
t.L... |
73bb50cd652acf4141e5cb1bab0fb54ecfa820eb | 30cc22fd30ce885a784f608d668bb1e6dac0c4c6 | lukechampine/uint128 | /uint128_test.go | Go | go | 12,428 | permissive | package uint128
import (
"crypto/rand"
"encoding/binary"
"math"
"math/big"
"net"
"testing"
)
func randUint128() Uint128 {
randBuf := make([]byte, 16)
rand.Read(randBuf)
return FromBytes(randBuf)
}
func TestUint128(t *testing.T) {
// test non-arithmetic methods
for i := 0; i < 1000; i++ {
x, y := randUin... |
a97d050b2390325f50a2a05cd01c77a1e16c9767 | 53d1865d47a3186479ed351d1c4e44137661b535 | seiji/cache | /memcache/cmd/root.go | Go | go | 2,931 | permissive | // Copyright © 2018 NAME HERE <EMAIL ADDRESS>
//
// 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 ... |
7e4eac01e27c74372361b6addec9d03e98b8ce82 | b812fa3a5f3d82f1c8501e9a8ef44035b9e0b5da | Slashyouth/arts | /tip/GoInAction/chapter8/logger.go | Go | go | 1,144 | no_license | package main
import (
"io"
"io/ioutil"
"log"
"os"
)
// 定制一套属于自己的logger
var (
Trace *log.Logger // 普通跟踪调试信息
Info *log.Logger // 特殊信息
Warning *log.Logger // 警告日志
Error *log.Logger // 错误日志(输出到文件)
)
func init() {
file, err := os.OpenFile("error.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != ... |
e4c00d5f9e5e06e8806a4e8b8fd5240c43a5077a | 0f0da153b9914c49fef251174855c0a8b9b70de2 | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go | Go | go | 5,222 | permissive | /**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
9cc2026b7ef035202324ce63f9e428aeea7b31bb | 5aa10821d0d515c1558d6edb0ca72ee62f3dd561 | dsyer/kpack | /pkg/secret/volume_secret_reader_test.go | Go | go | 917 | permissive | package secret_test
import (
"io/ioutil"
"os"
"path"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
"github.com/pivotal/kpack/pkg/secret"
)
func TestVolumeSecretReader(t *testing.T) {
testDir, err := ioutil.TempDir("", "secret-volume")
req... |
38bb3a4665acad1d6b8b64d975b8b837c80a8773 | 39fe4c0d23eba532987301015f4a2a5f02060c12 | dameleon/structr | /json_schema_test.go | Go | go | 3,042 | permissive | package main
import (
"encoding/json"
"github.com/dameleon/structr/fixtures"
"github.com/xeipuuv/gojsonpointer"
"testing"
)
func TestJsonSchema_GetItemList_ByObject(t *testing.T) {
var schema JsonSchema
itemsByObject := `{ "items": { "type": "string" } }`
json.Unmarshal([]byte(itemsByObject), &schema)
items :... |
35576a0e4d1a97680b166cd15d441fcc5412d02c | 75d823d7d68ec0d958625a6dca0464d7adc7293c | Azure/azure-sdk-for-go | /sdk/samples/azidentity/manual-tests/managed-identity/service-fabric/main.go | Go | go | 1,075 | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package main
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
... |
4ef3957ee89f25fd843cf7dd10b9fc14cf352451 | b19594a8483867765921ff0b6f933e1c139b9ed0 | xuxueyun-one/vdl | /consensus/rafthttp/msgappv2_codec_test.go | Go | go | 2,830 | permissive | // Copyright 2015 The etcd 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 t... |
aa072066dd7c7805c3db38b46ea6e00f9608e549 | 818f17c02c9e6459266b30216506d200e96a4e28 | tbloncar/advent-of-code | /2018/day4/main.go | Go | go | 2,458 | no_license | package main
import (
"fmt"
"io/ioutil"
"regexp"
"sort"
"strconv"
"strings"
)
const (
actionBegins = "begins"
actionSleeps = "sleeps"
actionAwakes = "awakes"
)
// Part 1
func checksum(entries []string) int {
guard, maxSleep, maxMinute := "", 0, 0
for g, schedule := range buildGuardSleepSchedule(entries) ... |
24947524d7def1b80a8e070109e6aa4e310c1db2 | 501d6ffa98a248e66f1d97005e86acadd5ec5498 | pairworking/humanizer | /number.go | Go | go | 3,468 | permissive | package humanizer
import (
"bytes"
)
type NumberValidator struct{}
func (NumberValidator) isValid(n interface{}) bool {
switch t := n.(type) {
case int, int32, int64:
_ = t
return true
default:
return false
}
}
type Humanizer struct {
}
func (n *Humanizer) ToWords(item interface{}) (string, error) {
n... |
14b9470eddd1c6c6cea64dbabca4a4c90a3b666a | 3a2fa4ebe86c178e8b4d957325dd80086ca6a28a | jindezgm/gmap | /logger.go | Go | go | 2,157 | no_license | /*
* @Author: jinde.zgm
* @Date: 2020-07-23 20:59:19
* @Descripttion:
*/
package gmap
import (
"fmt"
"os"
"path/filepath"
"github.com/natefinch/lumberjack"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
// Logger define log interface.
type Logger interface {
Debug(v ...interface{})
Debugf(format string, v... |
8b43a677134d48be4fe64248d62a6dda2e4e2a48 | 69fc5919cd4eb689a0aba0d27411fa6194125c40 | botherder/go-yara | /compiler_yara37_test.go | Go | go | 1,079 | permissive | //+build !yara3.3,!yara3.4,!yara3.5,!yara3.6
package yara
import (
"testing"
)
func setupCompiler(t *testing.T) *Compiler {
c, err := NewCompiler()
if err != nil {
t.Fatal(err)
}
c.SetIncludeCallback(func(name, rulefile, namespace string) []byte {
t.Logf(`Processing include "%s" (from ns="%s", file="%s")`, ... |
547ff0f5fa8609c291ae6f5f877f117f65bde970 | 2ee54659277e12bd16ed2e8761543a2b1221f41e | TomRoSystems/opentelemetry-collector-contrib | /exporter/awsxrayexporter/internal/translator/segment_test.go | Go | go | 35,852 | permissive | // Copyright 2019, 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 ag... |
9e2825cf9d708293ec838026b2ae2a9795b71d98 | 22cff5153e9de98a50cac380ea1995553defc34e | sumi-app/sumi_api | /app/store/sqlstore/store.go | Go | go | 912 | no_license | package sqlstore
import (
"database/sql"
"sumi/app/store"
_ "github.com/lib/pq" // ...
)
type Store struct {
db *sql.DB
bloggerRepository store.BloggersRepository
reviewsRepository store.ReviewsRepository
pressTourRepository store.PressTourRepository
}
//New ...
func New(db *sql.DB) *Store {
... |
9aefdab7bf3417489a1b1437d1f0c014b22c4944 | 48ae97a4c0790781782e820e6299318dbf5ecd49 | kedgeproject/kedgify | /vendor/github.com/openshift/origin/pkg/image/generated/clientset/typed/image/v1/fake/fake_imageresource.go | Go | go | 2,913 | permissive | package fake
import (
v1 "github.com/openshift/origin/pkg/image/apis/image/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client... |
0ee60b3155aadd798494972925b687750049e49c | cb21f9dc8903b076309088df6b3ad53862c3fe97 | Shopify/goose | /syncio/buffer.go | Go | go | 2,805 | permissive | package syncio
import (
"bytes"
"fmt"
"io"
"sync"
)
// Buffer is a wrapper on top of bytes.Buffer, but with a RWMutex to protect concurrent calls.
type Buffer struct {
l sync.RWMutex
b bytes.Buffer
}
func (rw *Buffer) Read(p []byte) (n int, err error) {
rw.l.Lock()
defer rw.l.Unlock()
return rw.b.Read(p)
}
... |
0f3fd1fe918bc24f5f7fb31dfd8fd38911fa4971 | 02a57e2329a18e5ae5c5327a84787e1930aa20c9 | mcdee/gomod | /lib/printer/clustering.go | Go | go | 5,988 | permissive | package printer
import (
"math"
"sort"
"strings"
"unicode"
"github.com/Helcaraxan/gomod/lib/depgraph"
)
func computeGraphClusters(config *PrintConfig, graph *depgraph.DepGraph) *graphClusters {
graphClusters := &graphClusters{
graph: graph,
clusterMap: map[string]*graphCluster{},
cachedDep... |
094f0b6b6871dd86b89a0417779d515c46a5d157 | be45e52f45e5a033113f30f7919c8580927aa3ae | cvmfs/docker-graphdriver | /plugins/overlay2_cvmfs/vendor/github.com/minio/minio-go/pkg/encrypt/cbc.go | Go | go | 6,693 | permissive | /*
* Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2017 Minio, 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
*
... |
2ebfad0f68723caa7f6f92e4f8fe07af5fdc94e3 | d3fe5788689839358bec65fad6e78e9eb3260000 | aliyun/dingtalk-sdk | /dingtalk/golang/smart_device_1_0/client.go | Go | go | 35,383 | permissive | // This file is auto-generated, don't edit it. Thanks.
/**
*
*/
package smart_device_1_0
import (
util "github.com/alibabacloud-go/tea-utils/v2/service"
openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
gatewayclient "github.com/alibabacloud-go/gateway-dingtalk/client"
openapiutil "github.com/ali... |
6d974da6c4e6b31c58f6f28d525010bc092ad2c4 | 40dbd0522c0622797b749c4c5afe417fbb05af13 | yanyuezhuo/kube-ebpf-exporter | /config/config.go | Go | go | 2,677 | permissive | package config
// Config defines exporter configuration
type Config struct {
Programs []Program `yaml:"programs"`
}
// Program is an eBPF program with optional metrics attached to it
type Program struct {
Name string `yaml:"name"`
Metrics Metrics `yaml:"metrics"`
Kprobes ... |
979d81ee96e1cf93610249a1932a9e302337de42 | 986de492a7554f136596df0d7645695ff34f4b15 | sabahtalateh/atourofgo | /src/structs/main/slices-of-slices.go | Go | go | 407 | no_license | package main
import (
"fmt"
"strings"
)
func main() {
// Create board.
game := [][]string{
[]string{"_", "_", "_"},
[]string{"_", "_", "_"},
[]string{"_", "_", "_"},
}
game[0][0] = "X"
game[2][2] = "O"
game[2][0] = "X"
game[1][0] = "O"
game[0][2] = "X"
printBoard(game)
}
func printBoard(s [][]strin... |
14e6213624ca0dfd84b55968ae1a87fe94e35af8 | 92ff2621faac29823bba9a51bc46b0c5db7f6749 | gjguanjie/go-api | /register/register.go | Go | go | 1,071 | no_license | package register
import (
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/consul"
"github.com/hashicorp/consul/api"
"github.com/pborman/uuid"
"os"
"strconv"
)
func Register(consulHost string, consulPort string, svcHost string, svcPort string,logger log.Logger) (registar sd.Regi... |
ea557f455681975125ce4a00f502cd171026ff4a | 4cf4576361dda00923aa1e39e5e49e737710c033 | al94hub/orbs-network-go | /config/config.go | Go | go | 8,481 | permissive | // Copyright 2019 the orbs-network-go authors
// This file is part of the orbs-network-go library in the Orbs project.
//
// This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
// The above notice should be included in all copies or substantial portion... |
68df47f9ba39c51a1363a335074e71d7522c5f09 | ca74bd0f594420139114e347ff247daf8ab05161 | garciaolais/telegraf | /plugins/inputs/processes/processes_test.go | Go | go | 5,177 | permissive | // +build !windows
package processes
import (
"fmt"
"runtime"
"testing"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestProcesses(t *testing.T) {
tester := tester{}
processes := &Process... |
5d32250de05e82342acd90d9f0137cb5eae7f6d0 | c76e81e226714bd1b10e90df7c425cfb388ea082 | roberthbailey/cluster-api-provider-gcp | /vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/machine.go | Go | go | 2,056 | 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, ... |
2c5449d886983f9cca67625853056aaa11a2cef7 | 6605c1858d69280a7ac75d055bc822c96eead46f | nunnatsa/piDraw | /notifier/notifier.go | Go | go | 1,569 | permissive | package notifier
import (
"log"
"sync"
"time"
)
type idProvider struct {
lock *sync.Mutex
counter int64
}
func (p *idProvider) getNextID() int64 {
p.lock.Lock()
p.counter++
newID := p.counter
p.lock.Unlock()
return newID
}
type Notifier struct {
clientMap map[int64]chan []byte
idp *idProvider
... |
1dc54a89cc9f2be1b3640f2b087b3ad0b5799b95 | 9b14ccc17cb34b55a3466de83fad556e783a8660 | etherscan-io/trillian | /testonly/hammer/reader.go | Go | go | 7,566 | permissive | // Copyright 2019 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... |
9370edffde1630219a24cdfcd97f61cc428ebd14 | 35c56dcf68eb165d7bdb251efc1a0a39a1f1d732 | jenkins-x-labs/bank-vaults | /cmd/vault-env/main.go | Go | go | 7,632 | permissive | // Copyright © 2018 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 ... |
55df935262331880f9bf707c082dca0733efca2c | f67187bd989b8b39e9e18acb770cb44c7706ef65 | rainzm/onecloud | /vendor/yunion.io/x/jsonutils/unmarshal.go | Go | go | 16,865 | 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... |
29f5275e9ad75fba8afbb472639eae1ce093f68d | 5a48a8d3ff40cb4acb93a687fc8fb2c9d390c19d | o-ran-sc/ric-plt-e2mgr | /E2Manager/handlers/rmrmsghandlers/x2enb_configuration_update_handler_test.go | Go | go | 2,821 | permissive | //
// Copyright 2019 AT&T Intellectual Property
// Copyright 2019 Nokia
//
// 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 ... |
6fa7c4e24b21edeec635a1104f3c2f5cc15f8849 | 33364180171bc4bbcf8e6db215064e2a73d6c8d3 | gomaglev/microshop | /internal/pkg/server/rpc/register.go | Go | go | 406 | permissive | package rpc
import (
"context"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
)
// IRegister interface for api services registration
type IRegister interface {
// RegisterServiceServers
RegisterServiceServers(server *grpc.Server)
// RegisterServiceHandlerFromEndpoints
RegisterSe... |
982a7730a9bd770d6c2b65099c437064e04d5a9c | 64d486e75adf6fffb2bb28428d2ee97c9524902d | kavonm/huobi_Golang | /pkg/getrequest/getrequest.go | Go | go | 732 | permissive | package getrequest
import (
"net/url"
)
// Manage the HTTP GET request parameters
type GetRequest struct {
urls url.Values
}
// Initializer
func (p *GetRequest) Init() *GetRequest {
p.urls = url.Values{}
return p
}
// Initialized from another instance
func (p *GetRequest) InitFrom(reqParams *GetRequest) *GetReq... |
e4569dcb40e62e082b22c5d54052b41d693daeee | 13c451bd4aa165e4a2114caabbc53f740bc20237 | SgtCoDFish/bedrock-bootstrap | /substratum/autotest/autotest.go | Go | go | 1,770 | permissive | package autotest
import (
"fmt"
"io"
"log"
"github.com/jacobsa/go-serial/serial"
"github.com/sgtcodfish/substratum"
)
const maxSerialWrites = 100
// State holds state which is required to run tests. Usually the state must be filled in prior to use.
type State struct {
// Logger is the default logger to use fo... |
377139f4369fb568336f56853e8495c675e73acc | 2865994edc698221f65f75301a4129680b3d68d0 | mauricext4fs/cig-exchange-p2p-backend | /controllers/organisationUserControllers.go | Go | go | 9,230 | permissive | package controllers
import (
cigExchange "cig-exchange-libs"
"cig-exchange-libs/auth"
"cig-exchange-libs/models"
"encoding/json"
"net/http"
"github.com/gorilla/mux"
)
// GetOrganisationUsers handles GET organisations/{organisation_id}/users endpoint
var GetOrganisationUsers = func(w http.ResponseWriter, r *htt... |
1c2421837a6ecd3e95fe39205760bb4a74aae1df | 08588455b01e0a8be10fc10cee238a5bef833fbb | BaritoLog/go-boilerplate | /httpkit/request_test.go | Go | go | 454 | permissive | package httpkit
import (
"crypto/tls"
"net/http"
"testing"
. "github.com/BaritoLog/go-boilerplate/testkit"
)
func TestSchemeOfRequest_https(t *testing.T) {
req := &http.Request{
TLS: &tls.ConnectionState{},
}
scheme := SchemeOfRequest(req)
FatalIf(t, scheme != "https", "wrong scheme")
}
func TestSchemeOf... |
65e26622dbe3fb83aab93b925559e67630b596ee | 6d2c2f094087e71957c0f82bb820ef693f211d99 | ganyyy/LeetGo | /Review/r17_09_getKthMagicNumber.go | Go | go | 517 | no_license | package main
import "math"
var val = [3]int{3, 5, 7}
func getKthMagicNumber(k int) int {
var dp = [3]int{0, 0, 0}
min := func(a, b int) int {
if a < b {
return a
}
return b
}
result := make([]int, 1, k)
result[0] = 1
for i := 2; i <= k; i++ {
rn := math.MaxInt32
for idx := 0; idx < 3; idx++ {
... |
06d66f17495f779cf12eac29258e0c1fec99e492 | c7e8e16fde4305adaeeecea76ca3dcd19a197a67 | yanrez/cluster-api | /api/v1alpha4/common_types.go | Go | go | 8,854 | permissive | /*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
97927c28b8e72b5d1ba19f5d98795209d8e0b88b | 31d73f3512c4145fca17d977c89857976de3c090 | lyft/cri-o | /vendor/k8s.io/kubernetes/pkg/features/kube_features.go | Go | go | 36,390 | 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, ... |
63e0d557fe3ed12f1b4e730abbd6566ccd7ddbeb | cda240526604b0b2381ba462f3c61ef7920e1dd7 | woodpecker-ci/woodpecker | /cmd/cli/app.go | Go | go | 1,929 | permissive | // Copyright 2021 Woodpecker 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... |
e75514a283d27d5fc6de5b8b093ad30b154ff29b | 7794c3f559aae020eb441a00e382c526b6de55bb | caixw/apidoc | /internal/lang/swift_test.go | Go | go | 2,331 | permissive | // SPDX-License-Identifier: MIT
package lang
import (
"testing"
"github.com/issue9/assert/v3"
"github.com/caixw/apidoc/v7/core"
"github.com/caixw/apidoc/v7/core/messagetest"
)
func TestSwiftNestCommentBlock(t *testing.T) {
a := assert.New(t, false)
b := newSwiftNestMCommentBlock("/*", "*/", "*")
a.NotNil(b... |
48624ef55475238267fa66ed49f404d8d745ac81 | e3836f6d3621ecfcc078e043957d92efd2af1f6a | jby123/tttt | /src/main/controller/vo/req/SysRoleReq.go | Go | go | 334 | permissive | package req
type SysRoleReq struct {
ID uint `json:"id"`
Name string `json:"name"`
Code string `json:"label"`
Status uint `json:"status"`
Remark string `json:"remark"`
MenuIdList []uint `json:"menuIdList"`
DepartmentIdList []uint `json:"departm... |
25cca90251563e7afbaa6308b52fd37046c5026c | d710a44d7269cc1d633531b3cf56d231fbb57c1b | hidevopsio/hiboot | /pkg/factory/autoconfigure/configurable.go | Go | go | 11,788 | permissive | // Copyright 2018 John Deng (hi.devops.io@gmail.com).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
f5befc411c8e996d9d4d31ae0d52757dc9436749 | 9660b9cb5b103b2c104ad621fcae91e5fe341a2d | Wh014M/juicyrout | /regex_test.go | Go | go | 5,513 | permissive | package main
import (
"bytes"
"io"
"strings"
"testing"
"github.com/gofiber/fiber/v2/utils"
"github.com/stretchr/testify/require"
)
func TestURLRegex(t *testing.T) {
tests := []struct {
input string
expected string
}{
{
input: "https://google.com",
expected: "//google.com",
},
{
input... |
a785773e485940f498b5c2ae88594ec9a7f020b2 | f2f34591b76a23492b046d6f8cdf946ddee185c3 | larskarlitski/osbuild-composer | /cmd/osbuild-dnf-json-tests/main_test.go | Go | go | 3,492 | permissive | // This package contains tests related to dnf-json and rpmmd package.
// +build integration
package main
import (
"fmt"
"io/ioutil"
"os"
"path"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/... |
eab758ab3a1e78c915fe04d83fd9aad325d2d697 | 36139b72d66eec8ad2386537cd8f6305eefbc174 | bigzhu/pg_backup_go | /logic/save.go | Go | go | 404 | no_license | package logic
import (
"fmt"
"log"
"os"
"time"
)
func getFileName(DBName string) (fileName string, err error) {
path := "pg_backup"
if _, err := os.Stat(path); os.IsNotExist(err) {
log.Println("make dir pg_backup")
os.Mkdir(path, os.ModePerm)
}
if err != nil {
return
}
t := time.Now()
now := t.Format... |
5efb75ef34761350a36e25d06796c8ece7ad7f1a | c9269457f9b109d6a32f8586ffd3c5dac6457000 | jbarlow801/kismatic | /pkg/inspector/check/package.go | Go | go | 1,568 | permissive | package check
import (
"fmt"
)
// PackageQuery is a query for finding a package
type PackageQuery struct {
Name string
Version string
}
func (p PackageQuery) String() string {
return fmt.Sprintf("%s %s", p.Name, p.Version)
}
// The PackageCheck uses the operating system to determine whether a
// package is i... |
57877fa3c4668c54d8381d6fe2340f04b07238d6 | 206cded8f0bd75555a3ed5a91fc965ecd951381f | danielnapierski/go-alt | /services/horizon/internal/actions_root.go | Go | go | 799 | permissive | package horizon
import (
"github.com/danielnapierski/go-alt/protocols/horizon"
"github.com/danielnapierski/go-alt/services/horizon/internal/ledger"
"github.com/danielnapierski/go-alt/services/horizon/internal/resourceadapter"
"github.com/danielnapierski/go-alt/support/render/hal"
)
// RootAction provides a summar... |
eb0ed88d6231b5f94f61e3cfb45a5cda92ce8e33 | affc7bd02f1b4d95e7ffe55796740b19eaa87147 | costeldragu/GoWorkspace | /src/com.enva/src/net/GetHeadInfo.go | Go | go | 625 | no_license | package main
import (
"fmt"
"io/ioutil"
"net"
"os"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: %s host:port ", os.Args[0])
os.Exit(1)
}
service := os.Args[1]
tcpAddr, err := net.ResolveTCPAddr("tcp4", service)
checkError(err)
conn, err := net.DialTCP("tcp", nil, tcpAddr)
checkEr... |
cc384251ef901d802cdd973201c8b275942ace44 | b5654252d97ec2fc6cde838d0a0c8ce2e2258998 | tmc/parse_graphql | /parse_class.go | Go | go | 5,832 | permissive | package parse_graphql
import (
"encoding/json"
"fmt"
"log"
"github.com/davecgh/go-spew/spew"
"github.com/tmc/graphql"
"github.com/tmc/graphql/executor/resolver"
"github.com/tmc/graphql/executor/tracer"
"github.com/tmc/graphql/schema"
"github.com/tmc/parse"
"golang.org/x/net/context"
)
var DefaultLimit = 5
... |
b185fc50c8713cef822d25dccf482b27361cf770 | 315e879f5fcbe1897acf8da729daf5297fbdc0f5 | DataDog/datadog-agent | /cmd/trace-agent/config/remote/config.go | Go | go | 3,680 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
package remote
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/htt... |
5d512a29adbd40ff20a0c0afc487942d4166cf6f | 365e2228b9609b11b8c15f1755af854dd33671ec | lewang321/antrea | /pkg/k8s/client.go | Go | go | 3,510 | permissive | // Copyright 2019 Antrea 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 ... |
d300ab0a6b883f1f9b327e52a0ecdc628950edc8 | 240f852941c43a1f0eb7dfc025662320eada58ee | ofekshabat/Containerization | /backend/images/db/db.go | Go | go | 1,240 | no_license | package db
import (
"context"
. ".."
mechola "../../db"
"go.mongodb.org/mongo-driver/bson"
)
// Returns the list of all images in the system
func List() ([]Image, error) {
ctx := context.Background()
cur, err := mechola.ImagesCollection.Find(ctx, bson.D{})
if err != nil {
return nil, err
}
defer cur.Close... |
20c9d7677b1a003515202f7aa1f9f1aee466f07d | 25820a2699d14ace65b221b31a1a7b9bdcb5b988 | fossabot/go-doudou | /pathutils/pathutils_test.go | Go | go | 1,225 | permissive | package pathutils
import (
"strings"
"testing"
)
func TestAbs(t *testing.T) {
type args struct {
rel string
}
tests := []struct {
name string
args args
want string
}{
{
name: "",
args: args{
rel: "testfiles",
},
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *tes... |
0504e4cc456cb7b40636bedecd95a6ae5fe1f3a9 | a9d8b05f856278ad4d4b93ecec79c01c092d79c1 | DayvonAllen/go-advanced-security | /oauth2/main.go | Go | go | 3,510 | no_license | package main
import (
"encoding/json"
"fmt"
"golang.org/x/oauth2/github"
"io/ioutil"
"log"
"net/http"
"strings"
"golang.org/x/oauth2"
)
//mock database table
// key is github ID, value is our database user ID
var githubConnections map[string]string
// unmarshal github response
type githubResponse struct {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.