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 |
|---|---|---|---|---|---|---|---|---|
e582278bc5344abd0fc28027aa4d5631393c4169 | 0e267210f1601e8c1c3717bea6a74cbe734efee9 | david-acuitydigital/influxdb | /tsdb/config_test.go | Go | go | 4,382 | permissive | package tsdb_test
import (
"testing"
"time"
"github.com/BurntSushi/toml"
"github.com/influxdata/influxdb/tsdb"
)
func TestConfig_Parse(t *testing.T) {
// Parse configuration.
c := tsdb.NewConfig()
if _, err := toml.Decode(`
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
wal-fsync-delay = "10... |
4e7f86b24f4d20a385644fb557881d3734748283 | b4a282e5f05b474e5ec84f640b23abe4ff2b2ea2 | utappoco/gloo | /projects/gloo/pkg/api/compress/compress.go | Go | go | 4,295 | permissive | package compress
import (
bytes "bytes"
"compress/zlib"
"encoding/base64"
"encoding/json"
"io"
"github.com/rotisserie/eris"
"github.com/solo-io/solo-kit/pkg/api/v1/clients/kube/crd"
v1 "github.com/solo-io/solo-kit/pkg/api/v1/clients/kube/crd/solo.io/v1"
"github.com/solo-io/solo-kit/pkg/api/v1/resources"
"gi... |
d4f387216c193fc635d164434cf3847629fe69d7 | 4d2d947fc23559536385e9be592c27868c1d0fa5 | h12w/dfa | /cache_test.go | Go | go | 247 | permissive | package dfa
import (
"fmt"
"os"
"testing"
)
func SkipTestGenCache(t *testing.T) {
w, _ := os.Create("cache.go")
defer w.Close()
fmt.Fprintln(w, "package dfa")
fmt.Fprint(w, "var classL = ")
L, _ := charClass("L")
L.WriteGo(w, "dfa")
}
|
09f137aadd50f6485e8c476dfb6d068d6af89522 | cef045f59a09a58870e36d6dc606ac4e2a916ca2 | quasilyte/go-ruleguard | /analyzer/testdata/src/namedtype/nested/rules.go | Go | go | 758 | permissive | // +build ignore
package gorules
import "github.com/quasilyte/go-ruleguard/dsl"
func testRules2(m dsl.Matcher) {
// Override the default text/template to html/template.
m.Import(`html/template`)
m.Match(`sink = &$t`).
Where(m["t"].Type.Is(`template.Template`)).
Report(`html Template`)
}
func testRules(m dsl... |
1abf6babaf294b058bec1e116e32deebb6523847 | 0982fb1fe0b7b5ed244e7822dc8b33106c45ad77 | patluri43/terraform-provider-okta | /okta/resource_okta_policy_rule_sign_on_test.go | Go | go | 2,942 | permissive | package okta
import (
"fmt"
"regexp"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)
func deleteSignOnPolicyRules(client *testClient) error {
return deletePolicyRulesByType(signOnPolicyType, client)
}
func TestAccOktaPolicyRule... |
776ace4ceb4f2cf994c72a5fe70664cbb477c17b | d7547e8811fa97f22ff5560909d3728c29414cfc | aerogo/linter-performance | /Linter_test.go | Go | go | 447 | permissive | package performance_test
import (
"testing"
"github.com/aerogo/http/client"
performance "github.com/aerogo/linter-performance"
"github.com/akyoto/assert"
)
func Test(t *testing.T) {
linter := performance.New()
linter.Begin("eduardurbach.com", "eduardurbach.com")
response, err := client.Get("https://eduardurba... |
b1f443a1e9a1f634ef039c3012cdb8e75f938344 | 9c5c42f84e104252170bdf85b2ca54bfc88571a2 | GPFAFF/truth-bot | /main.go | Go | go | 633 | no_license | package main
import (
"fmt"
credentials "github.com/gpfaff/truth-bot"
"os"
)
func main() {
fmt.Println("Go-Twitter Bot v0.01")
creds := credentials.Credentials{
AccessToken: os.Getenv("ACCESS_TOKEN"),
AccessTokenSecret: os.Getenv("ACCESS_TOKEN_SECRET"),
ConsumerKey: os.Getenv("CONSUMER_KEY"),
... |
753e25eaef19eece3a4f5770edc2a569c0c96491 | 40bf7e16e60bb649bfc5299fdcb7dc827c45ac18 | NavyAdmiral/chainlink | /services/subscription.go | Go | go | 14,868 | permissive | package services
import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math/big"
"time"
ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/smartcontractkit/chainlink/logger"
strpkg "github.com/smartcontractkit/c... |
3b5c09d3be004c2fc9d86b717c9b877883461872 | 2ef86ce2a6ff3eeeb0bb984c1cb664212f3756e2 | SemanticallyNull/gotestsum | /cmd/tool/slowest/slowest_test.go | Go | go | 2,035 | permissive | package slowest
import (
"bytes"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp/cmpopts"
"gotest.tools/gotestsum/testjson"
"gotest.tools/v3/assert"
"gotest.tools/v3/env"
"gotest.tools/v3/golden"
)
func TestUsage_WithFlagsFromSetupFlags(t *testing.T) {
defer env.PatchAll(t, nil)()
name := "gotes... |
bf13f3f47d3ae78c04cef73e4a0297f1df11e748 | a0baf1192bd2d564a8a99e4d6569ff2f46e7cf7b | kngoyal/mit-distributed-systems | /6.824/src/lectures/5/go-concurrency/mutex/basic.go | Go | go | 274 | no_license | package main
import (
"sync"
"time"
)
func main() {
counter := 0
var mu sync.Mutex
for i := 0; i < 1000; i++ {
go func() {
mu.Lock()
defer mu.Unlock()
counter = counter + 1
}()
}
time.Sleep(1 * time.Second)
mu.Lock()
println(counter)
mu.Unlock()
}
|
d3dbb8648b7adaa0a082f025cce5b0143bd28ce3 | 58b4afa8ff4dc093aab9f15ab0bcb7d4dcddd942 | KennyChenFight/golang-json-tutorial | /json03/main.go | Go | go | 347 | permissive | package main
import (
"encoding/json"
"fmt"
)
func main() {
user := map[string]string{
"name": "Kenny",
"gender": "Male",
}
b, err := json.Marshal(user)
if err != nil {
panic(err)
}
fmt.Println(string(b))
var newUser map[string]string
err = json.Unmarshal(b, &newUser)
if err != nil {
panic(err)
... |
2581299506627ddda7f2bcb2cd6cf9abd71fd27a | 130652f033849249b97319df2998d8ae0f9f1d2b | byteman/bylib | /bybus/ModbusRtuServer.go | Go | go | 3,463 | no_license | package bybus
import (
"bylib/bylog"
"bylib/byutils"
"github.com/pkg/errors"
"github.com/tarm/serial"
"github.com/xiegeo/modbusone"
"sync"
)
const size = 0x10000
type MBServer struct{
Port int
Baud int
holdingRegisters [size]uint16
holdMux sync.Mutex
readWriteHandler map[uint16]*ModbusReadWriteHandler
}
... |
2e26a0bdfa08667b5ded79fe9b96a7c73bb0a25a | c0046814002323941be81598c7dcc4606a76174d | rainzm/onecloud | /pkg/cloudcommon/db/taskman/subtasks.go | Go | go | 3,170 | 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... |
e14f7804cb9b26fa8a074565d7bc1e958f1bf449 | 9f90cf9b983b8d4a88b0f5778070c4d75246854c | LehighRacing/gollum | /docs/generator/definition.go | Go | go | 5,658 | permissive | package main
import (
"fmt"
"regexp"
"strings"
)
// Definition represents a single metadata or configuration parameter definition
// with optional nested definitions
type Definition struct {
desc string
name string
dfl string
unit string
parent *Definition
children DefinitionList
}
func (... |
651a4fe55167c5729dbcffb44c5a484c24ed4351 | 65ac0d912a810f112ee0a4d36d956442cab784aa | slava-vishnyakov/beats | /topbeat/beat/sigar.go | Go | go | 3,659 | permissive | package beat
import (
"fmt"
"strings"
"time"
"github.com/elastic/gosigar"
)
type SystemLoad struct {
Load1 float64 `json:"load1"`
Load5 float64 `json:"load5"`
Load15 float64 `json:"load15"`
}
type CpuTimes struct {
sigar.Cpu
UserPercent float64 `json:"user_p"`
SystemPercent float64 `json:"system_p"`
}... |
56720c05a917d7e2303f60a266df8b719ce65165 | 3346d43c4e1a3f17c0aa424ba1074becbe8ba5da | google/gvisor | /test/packetimpact/tests/tcp_synrcvd_reset_test.go | Go | go | 2,236 | permissive | // Copyright 2020 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... |
14b45b67b6694b4c9ef485eda4cecfad36f81b4e | 635e40399c1edcc1af02217e01c3f8d7ca394dc6 | superfly/flyctl | /internal/logger/writer_logger.go | Go | go | 355 | permissive | package logger
import (
"fmt"
"io"
)
type WriterLogger struct {
out io.Writer
level Level
isTerm bool
}
func (l *WriterLogger) WriteLog(level Level, line string) {
if level < l.level {
return
}
fmt.Fprint(l.out, line)
}
func (l *WriterLogger) UseAnsi() bool {
return l.isTerm
}
func (l *WriterLogger)... |
78e793d88160ebc37454138e75e15ed4f3de2329 | 678eeaf40e8006bde977f2c62e40c5576ecd931f | vapao/Monitor | /src/tools/weixin.go | Go | go | 4,250 | no_license | package tools
import (
"bytes"
"config"
"encoding/json"
"errors"
"fmt"
"gopkg.in/mgo.v2/bson"
"logger"
"models"
"net/http"
"strings"
"time"
)
var accessToken struct {
Token string
ExpiresAt time.Time
}
type accessTokenReturn struct {
AccessToken string `json:"access_token"`
Expires_In int `jso... |
43fc4b4b58fade729699bcb886e4a90557ab9472 | ab1beaa77be2d97305f1a2c4def163ebf2e02dc0 | eosspark/geos | /plugins/appbase/app/plugin.go | Go | go | 2,117 | permissive | package app
import (
"github.com/urfave/cli"
. "github.com/eosspark/eos-go/exception/try"
)
/** these notifications get called from the plugin when their state changes so that
* the application can call shutdown in the reverse order.
*/
//Register(abstract_plugin) error
type Plugin interface {
SetProgramOption... |
6723aa82e6b439af73e41abbd6fa8a9c0b1ae251 | 167b056fddcaddefb6dedc1f9e062ec4c04807ab | m104/baseplate.go | /timebp/second_f_test.go | Go | go | 3,884 | permissive | package timebp
import (
"encoding/json"
"math/rand"
"reflect"
"strings"
"testing"
"testing/quick"
"time"
)
type jsonTestTypeSecondF struct {
Timestamp TimestampSecondF `json:"timestamp,omitempty"`
}
type randomSecondFloat float64
func (randomSecondFloat) Generate(r *rand.Rand, _ int) reflect.Value {
return... |
93755825327f759dc83c884ac58735d9f0c93402 | c3c4abb678823fc5c00c9478caa65f5c77df03e9 | isaacev/Plaid_v1 | /frontend/nodes.go | Go | go | 21,674 | permissive | package frontend
import (
"github.com/isaacev/Plaid/source"
)
// Node is a generic node in the abstract syntax tree (AST)
type Node interface {
Pos() source.Pos
End() source.Pos
}
/**
* ROOT PROGRAM NODE
*/
// ProgramNode is the root node for an AST
type ProgramNode struct {
Statements []Stmt
// this field ... |
9840c4356070f7517c551c0e1c7cdc7e4440567d | 2882d60537aa7b47c3b4125b9bb55576d9a07701 | darvin/expreduce | /expreduce/builtin_functional.go | Go | go | 18,499 | permissive | package expreduce
import (
"math/big"
)
//The following functions help to interpret the Ex interface, they could probably be moved
//to another file since they are useful in many common situations
func parseInteger(part Ex) (value int64, isInteger bool) {
integer, isInteger := part.(*Integer)
if isInteger {
ret... |
80da2ed3e22469065925f98ac0f611c1bd374da2 | 76496ceb4ed059d1f049d08f2021ef0b20b2dc0d | midstar/plm | /logger_test.go | Go | go | 2,402 | permissive | package main
import (
"testing"
"time"
)
func TestLogger(t *testing.T) {
logger := CreateLogger(3)
currentTime := time.Now()
time.Sleep(50 * time.Millisecond) // To make time differ
assertTrue(t, "Oldest date on empty log", currentTime.Before(logger.OldestDate()))
assertEqualsInt(t, "Oldest index on empty lis... |
9fabdbe3989c3edf2f60257273054500d6838953 | daa686a2c71561020a5fb4d6a7eedea3ffa232c8 | siddhantac/monkey | /lexer/lexer_test.go | Go | go | 2,513 | no_license | package lexer
import (
"testing"
"github.com/sidc9/monkey/token"
)
func TestNextToken(t *testing.T) {
//input := `=+(){},;`
input := `let five = 5;
let ten = 10;
let add = fn(x, y) {
x+y;
};
let result = add(five, ten);
!-/*5;
5 < 10 > 5;
if (5 < 10) {
return true;
} else {
return fal... |
ab759c172970ed13058ce113aeeec8e8b2a24c65 | deacc2f49b05f584ff65658d07df173b69bc4fd4 | CJianWei/ccommon | /util/err.go | Go | go | 244 | no_license | package util
import (
"errors"
"fmt"
)
// @Time : 2018/3/27 9:55
// @Author : chenjw
// @Site :
// @File : err.go
// @Software: GoLand
func Err(f string, args ...interface{}) error {
return errors.New(fmt.Sprintf(f, args...))
}
|
3d37a84afc41bf28edef497005d7a628e61c6e56 | b1cb8b46c1d13c19e4b8fa5f9eca725639cb614a | pingcap/tidb-tools | /pkg/regexpr-router/regexpr_router.go | Go | go | 5,977 | permissive | // Copyright 2022 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
2d2ed8fd8b82995ff089347b189e66c4b98564f4 | bd0e2cf0c89f05d642aa6562bb37d9b08d24d500 | EugeneSayapin/CrackingCodingInterview | /chapter1/problem5/problem5.go | Go | go | 1,350 | no_license | package main
import (
"fmt"
)
func isReplace(s1, s2 string) bool {
rune1 := []rune(s1)
rune2 := []rune(s2)
seenReplace := false
for i := range rune1 {
if rune1[i] != rune2[i] {
if seenReplace {
return false
}
seenReplace = true
}
}
return seenReplace
}
func isInsert(longer, shorter string) boo... |
9754cf0c84cd86da67e86114ed132060c44fdf65 | 4547f3645f775ab9d10f3b88a8447cf35535b1c5 | Peripli/service-manager-cli | /internal/cmd/version/version_test.go | Go | go | 885 | permissive | package version
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"bytes"
"fmt"
"testing"
"github.com/Peripli/service-manager-cli/internal/cmd"
)
func TestVersionCmd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "")
}
var _ = Describe("Login Command test", func() {
var command *Cmd
... |
ccab431b5d10f32a3bea1306792552b7b25041a9 | d1f64b08cfec62d7255a02976ec14986cfe316c1 | atyenoria/vitess | /go/vt/tabletmanager/agent.go | Go | go | 15,580 | 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 tabletmanager exports the ActionAgent object. It keeps the local tablet
state, starts / stops all associated services (query service,
update stream, bin... |
12681ff3b654adf820e6648ca4f6e55562e0d43b | 09f3a4d82b5fed6c190e6804bec690cf0b2856f5 | bububa/opentaobao | /api/media/TaobaoMiniappCloudPictureToken.go | Go | go | 1,273 | permissive | package media
import (
"github.com/bububa/opentaobao/core"
"github.com/bububa/opentaobao/model/media"
)
// TaobaoMiniappCloudPictureToken 云存储上传token获取
// taobao.miniapp.cloud.picture.token
//
// 获取图片上传token,作为http://upload.cloud.tmall.com/api/proxy/upload接口上传的凭证。
//
// 上传的html示例代码为:
// &lt;form action=&quot... |
39e01eeaf7196ddc0f646bb5589b54c4b65faf33 | 1b973b11f4fdbb7146eb2fe80da95fd4a85d2dc3 | polar9527sun/leetcode | /go/src/leetcode/25.k-个一组翻转链表.go | Go | go | 2,013 | no_license | /*
* @lc app=leetcode.cn id=25 lang=golang
*
* [25] K 个一组翻转链表
*
* https://leetcode-cn.com/problems/reverse-nodes-in-k-group/description/
*
* algorithms
* Hard (58.40%)
* Likes: 545
* Dislikes: 0
* Total Accepted: 65.3K
* Total Submissions: 108K
* Testcase Example: '[1,2,3,4,5]\n2'
*
* 给你一个链表,每 k 个... |
8fab4470b58667b586e1d3b98270b32cca4abea1 | be71594abada41a3bce0627f27c19097e31197d2 | f110/heimdallr | /pkg/logger/logger.go | Go | go | 3,274 | permissive | package logger
import (
"context"
"reflect"
"sync"
"github.com/spf13/pflag"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/xerrors"
"go.f110.dev/heimdallr/pkg/cmd"
"go.f110.dev/heimdallr/pkg/config/configv2"
)
var (
Log *zap.Logger
LogConfig *zap.Config
Audit *zap.Logger
flagConf ... |
296c45a04bc7af4cd26a53f28b1ded4283c977ed | 7505a102de04bb13a6b67b60fe87d5f221e3369b | mastern2k3/godot-go | /godot/windowdialog.gen.go | Go | go | 6,071 | permissive | package godot
import (
"github.com/shadowapex/godot-go/gdnative"
)
/*------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Any updates should be... |
876746b9be3b85bc6588edbdb1e8d2f55b343355 | a1839a28d4cc147fc76686510e7eb61a7dc0413f | paintcast/smartcrop | /crop.go | Go | go | 13,657 | permissive | /*
* Copyright (c) 2014 Christian Muehlhaeuser
*
* 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, mer... |
cff8dae5a37311c424758d370b6f383c3fff9cd3 | 705f08eb47a01877fde9270690310d8e276d6779 | gorakhargosh/play | /src/golang/src/basics/environment-variables.go | Go | go | 291 | no_license | package main
import "os"
import "strings"
import "fmt"
func main() {
os.Setenv("FOO", "1")
fmt.Println("FOO:", os.Getenv("FOO"))
fmt.Println("BAR:", os.Getenv("BAR"))
fmt.Println()
for _, e := range os.Environ() {
pair := strings.Split(e, "=")
fmt.Println(pair[0], pair[1])
}
}
|
07304a62d214e36f440bb2314abb0bdb96416122 | b34368412d9bd25b7edd801488a7cfe416132bf4 | ferhatelmas/gopass | /utils/pwgen/pwgen_test.go | Go | go | 238 | permissive | package pwgen
import "testing"
func TestPwgen(t *testing.T) {
for _, sym := range []bool{true, false} {
for i := 0; i < 50; i++ {
sec := GeneratePassword(i, sym)
if len(sec) != i {
t.Errorf("Length mismatch")
}
}
}
}
|
93bb05942f8b3980535c020848741274bbbb76b7 | 301efecdcd79f5a85b9e2aa766e43a6ef3b223e6 | sunminghong/gotools | /idassign.go | Go | go | 4,242 | permissive | /*=============================================================================
# FileName: idassign.go
# Author: sunminghong, allen.fantasy@gmail.com, http://weibo.com/5d13
# Team: http://1201.us
# LastChange: 2013-11-21 15:51:44
# History:
=====================================================... |
0693b537bb26ac44853232436b4dd5809059a648 | 78803146c15c09b2d4209aefa427e95ed373f36c | axgle/axgle.github.com | /go/src/pkg/math/sqrt_decl.go | Go | go | 6,122 | permissive | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Source file /src/pkg/math/sqrt_decl.go</title>
<link rel="stylesheet" type="text/css" href="../../../doc/style... |
972ee93359aa7d0725d22fe69152c1dc3c6f0f94 | 82aa3232dbd73514ea58e7e76fe2f5b61061ba80 | tetora1053/mizuumi-app | /go/server.go | Go | go | 5,434 | no_license | package main
import (
"fmt"
"log"
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"github.com/ipfans/echo-session"
"strconv"
"./utils/dao"
"bytes"
"bufio"
"image"
_ "image/gif"
"image/jpeg"
_ "image/png"
"golang.org/x/image/draw"
"golang.org/x/crypto/bcrypt"
)
type Movie st... |
eff73a273e14c5c7bc88c5f8ede1db7a39f926d2 | a81ab7fe28d828a33004148a25438f7ceaefc7a9 | yonlugoh/golang_leetcode | /130. Surrounded Regions/solveBoard_test.go | Go | go | 1,994 | no_license | package _30__Surrounded_Regions
import (
"reflect"
"testing"
)
func TestSolveBoard(t *testing.T) {
tests := [][][]byte{
[][]byte{{'X', 'X', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'X', 'O', 'X'},
{'X', 'O', 'X', 'X'}},
[][]byte{{'X', 'O', 'X', 'O', 'X', 'O', 'O', 'O', 'X', 'O'},
{'X', 'O', 'O', 'X'... |
5941538bd251884bb3441a582216727a7f5387b3 | 3c1168fbaec44e423ec2974a83e1a3b076eea0b2 | dsalcedo/go-blade | /lexers/section.go | Go | go | 480 | no_license | package lexers
import "regexp"
const (
StartSectionPattern = `@section()`
EndSectionPattern = `@stop`
SectionContentPattern = `@section\((.*)\)(.*)@stop`
)
type Section struct{}
func (section *Section) Parse(context []byte) []byte {
return context
}
func (section *Section) BlockContent(context []byte) (s... |
2b41d0a19997092eb57b8ae54dde27c4ed3c1846 | b174bbdfd3bd31271a58f3e96c5bf593d6ecaa99 | lyft/tilt | /internal/logger/func_logger.go | Go | go | 1,278 | permissive | package logger
import (
"fmt"
"io"
)
// A logger that writes all of its messages to `write`
type funcLogger struct {
supportsColor bool
level Level
write func(level Level, b []byte) error
}
var _ Logger = funcLogger{}
func NewFuncLogger(supportsColor bool, level Level, write func(level Level, b... |
aada9720ea6c61982daf1003c82af57c4bc38e7c | 787f42cae7d0638bfe786809b26eeaacd5362842 | EJKinger/gdb2cm | /gdb2cm.go | Go | go | 3,283 | no_license | package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/alecthomas/kingpin"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/models"
yaml "gopkg.in/yaml.v2"
)
var (
dashboardFile = kingpin.Flag("file.dashboard", "Grafana dashboard JSON file ... |
f71f670ee7c8df269ee9dd88a0f5e391e19a6310 | c317d1419533bd6a529d3c33abae654ef89c71dd | onflow/cadence | /runtime/tests/checker/enum_test.go | Go | go | 4,640 | permissive | /*
* Cadence - The resource-oriented smart contract programming language
*
* Copyright Dapper 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/l... |
13804ba37743d2c2ffd3a87bdeba100c23c168b3 | a669e842b39574c444cabb89ca25920517fded7f | pierrre/imageserver | /http/graphicsmagick/graphicsmagick_test.go | Go | go | 4,450 | permissive | package graphicsmagick
import (
"net/http"
"net/url"
"testing"
"github.com/pierrre/imageserver"
imageserver_http "github.com/pierrre/imageserver/http"
)
var _ imageserver_http.Parser = &Parser{}
func TestParse(t *testing.T) {
p := &Parser{}
for _, tc := range []struct {
name string
query ... |
8e9565990d302d73c2b06b40e2a1697297cc6b81 | fc15c464fbb7ecc7456620f8eb8e1688c5a85c6a | cool8sniper/gin-rest-gorm-rbac-sample | /database/models/user.go | Go | go | 1,474 | permissive | package models
import (
"fmt"
"github.com/gin-rest-gorm-rbac-sample/database/mysql"
"github.com/gin-rest-gorm-rbac-sample/lib/common"
)
type User struct {
ID uint
Name string
Age uint8
Email string
Password string
}
type UserRole struct {
UserId uint `gorm:"primary_key"`
RoleId uint `gor... |
c3d289ffd9837e54fb6d6398a85f0b8f18509487 | 85655adb06110fa4e3bdcb80ccf6dec768eed638 | ZASXCDFVA/github-release-puller | /config/Config.go | Go | go | 479 | permissive | package config
type AssetFilter struct {
Match string `yaml:"match,omitempty"`
}
type AssetPuller struct {
Name string `yaml:"name"`
Owner string `yaml:"owner"`
Repository string `yaml:"repository"`
Tag string `yaml:"tag,omitempty"`
Destination string `yaml:"destination"`
Interval uint... |
3a2c31b302566c1a20c00e6d68411a6af40d5d6a | 722505de25551033d5167df7f77dd376491f8ab2 | jameshuynh/corn | /helpers/load_config.go | Go | go | 1,922 | permissive | package helpers
import (
"errors"
"fmt"
"os"
"github.com/BurntSushi/toml"
)
// DBConfig Type for MySql
type DBConfig struct {
Development Postgresql
Test Postgresql
Staging Postgresql
Production Postgresql
}
// Postgresql is postgresql struct to expose data of db connection
type Postgresql struc... |
39df254511b725e5b3194b206ee784090b658c60 | f925cacf7fc39e4a078c6a80510f3bdfc9e64b37 | mikhailshilkov/pulumi-terraform-bridge | /pkg/tfbridge/names.go | Go | go | 5,246 | permissive | // Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... |
b354e4ac7fe1b97dd56d577bd1efc7b6c00a5da2 | 3a5c07bb187f3a189bc45c456cd5493d3939890a | haruyama/fresh | /runner/runner.go | Go | go | 526 | permissive | package runner
import (
"io"
"os/exec"
)
func run() bool {
runnerLog("Running...")
cmd := exec.Command(buildPath(), args()...)
stderr, err := cmd.StderrPipe()
if err != nil {
fatal(err)
}
stdout, err := cmd.StdoutPipe()
if err != nil {
fatal(err)
}
err = cmd.Start()
if err != nil {
fatal(err)
}... |
e6d2989707b949e451a9245f68500113affac750 | 0af9c7af0b4987d0aa19b7d116909a3d41f27437 | lyft/atlantis | /server/neptune/gateway/requirement/base_branch_test.go | Go | go | 1,063 | permissive | package requirement
import (
"context"
"regexp"
"testing"
"github.com/runatlantis/atlantis/server/config/valid"
"github.com/runatlantis/atlantis/server/models"
"github.com/stretchr/testify/assert"
)
var regex = regexp.MustCompile(`abc`)
func TestBaseBranch(t *testing.T) {
globalCfg := valid.GlobalCfg{
Repo... |
24e2c840ffe6b63292d5774ddfa30f3a509b8894 | 8399ada758bc688b35ba2e786281561de4bb38c4 | tunein/go-avro | /codegen/codegen.go | Go | go | 2,011 | permissive | /* Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this fi... |
a4bbf0c435e51e749f98a17e96a804f56ea23b4f | 1bac871ad804f5fe1ee91781fd3b1690bd521929 | jwolski/topn | /main.go | Go | go | 5,833 | no_license | package main
// This program can be used to output the N largest integers from a file or
// from stdin. It assumes that there is one integer per line. If the line
// cannot be converted to an integer, it will be skipped. The integers are
// printed on a single line in descending order.
//
// Both N and the file can be... |
fce643c549bc9c5a96bceabfbfe3b734f09f40ca | 59dce259bcd280d41f09e30983662bd74d05a248 | atlasx51/golang_2018FA | /28_practice/main.go | Go | go | 240 | no_license | package main
import (
"fmt"
)
func main() {
name := "Sam"
str := `html here ` + name + `more html`
fmt.Println(str)
// fmt.Println(os.Args[0])
// fmt.Println(os.Args[1])
// fmt.Println(os.Args[2])
// fmt.Println(os.Args[3])
}
|
531c93bc66345ce807d3bd64544a706c0c0ef8dc | 7b2459aa8cb6275c4968653e200d042e3e8d30bd | zhouzhiguang2020/algo_golang | /07-Graph-Basics/06-Finding-a-Path/main.go | Go | go | 456 | no_license | package main
import (
"algo_golang/07-Graph-Basics/core"
"fmt"
)
func main() {
G_txt := "07-Graph-Basics/06-Finding-a-Path/testG.txt"
rg := core.ReadGraph{}
g1 := core.NewSparseGraph(7,false)
err := rg.Read(g1, G_txt)
if err != nil{
fmt.Println(err)
return
}
fmt.Println("test G1 in Sparse Graph:")
g1.Sh... |
a3fcbbe8dc54688944836f5b39fd8716400e6bdc | 30ca504868cf75c78e63959fc2a49c6420c897fe | ggncnt/go | /services/horizon/internal/helpers_test.go | Go | go | 1,364 | permissive | package horizon
import (
"bytes"
"encoding/json"
"fmt"
"log"
"github.com/PuerkitoBio/throttled"
hlog "github.com/ggncnt/go/services/horizon/internal/log"
"github.com/ggncnt/go/services/horizon/internal/test"
)
func NewTestApp() *App {
app, err := NewApp(NewTestConfig())
if err != nil {
log.Panic(err)
}
... |
a0fc7c47c2209c4f5a51fea977ffe2703514fcc8 | 9f6aa9114bb91145e4823ca1a9d8532386b4f46c | samnela/http-broadcast | /pkg/server/handler.go | Go | go | 2,179 | permissive | package server
import (
"encoding/json"
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"strconv"
"strings"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/jderusse/http-broadcast/pkg/dto"
)
func (s *Server) handle(w http.ResponseWriter, r *http.Request) {
rStr, _ := httputil.DumpRequ... |
01a2cd32e55ebab97ca0ba3672231f3cdc3e87f4 | 0fcf76f4f1c32babde7026b2e41b960d0d0899ba | giantswarm/test-operator | /service/controller/v4/resource/ingress/desired.go | Go | go | 719 | permissive | package ingress
import (
"context"
"fmt"
"github.com/giantswarm/microerror"
"k8s.io/api/extensions/v1beta1"
"github.com/giantswarm/kvm-operator/service/controller/v4/key"
)
func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) (interface{}, error) {
customObject, err := key.ToCustomObject(o... |
f0298ceebcb16fce1f84981d1d7ef2409d141aa2 | 570d558c26718c0e299552950671239762e8ab3a | Dingshujie/istio | /mixer/test/client/env/setup.go | Go | go | 9,281 | permissive | // Copyright 2017 Istio Authors. 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 applica... |
443dcd45da2d109e0ddcd1ab501e9362f90fe6e5 | b8d47ff4fe3018227175c6bd47e0db64815dec17 | thockin/kubernetes | /staging/src/k8s.io/apiserver/pkg/registry/rest/rest.go | Go | go | 18,679 | permissive | /*
Copyright 2014 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, ... |
dfd97181e1d1d5ca5e58ee518fb22bc4aa9516e6 | 64b1c1e8fd8bb8e397e673c61b616338c5a1bfb5 | vivimouret29/pulumi-azure-native | /sdk/go/azure/automation/v20210622/hybridRunbookWorker.go | Go | go | 4,671 | permissive |
package v20210622
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type HybridRunbookWorker struct {
pulumi.CustomResourceState
Ip pulumi.StringPtrOutput `pulumi:"ip"`
LastSeenDateTime pulumi.StringPtrOutput `pulumi:"lastSeenDateTime"... |
0f31ff3d03c00100bcaa8e84fbf5957fbd11fd4a | bbaff3f01ba912eda3f4498ae74702a518f26e92 | openshift-hive/hypershift | /hypershift-operator/controllers/nodepool_controller.go | Go | go | 10,743 | permissive | package controllers
import (
"context"
"fmt"
"time"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"github.com/go-logr/logr"
configv1 "github.com/openshift/api/config/v1"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimac... |
75abe8cbe14e0b4e2098468ae62129c44e61ebc6 | f6da9f4fb8279a49c1ac47a936ef3975a8f501ed | zipper-project/zipper | /vm/invoke.go | Go | go | 11,020 | permissive | // Copyright (C) 2017, Zipper Team. All rights reserved.
//
// This file is part of zipper
//
// The zipper is free software: you can use, copy, modify,
// and distribute this software for any purpose with or
// without fee is hereby granted, provided that the above
// copyright notice and this permission notice appea... |
abd413684c977cc1c2c7d0225ce40201b4c34152 | 64ee35a95ec7f9d9a1de74cc516088452b583766 | iCodeIN/npwg | /ch06/tftp-server/tftp/ack_test.go | Go | go | 530 | permissive | package tftp
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMarshalAckDatagram(t *testing.T) {
d := NewAck(5)
expected := []byte{
0x00, 0x04, // OpAck
0x00, 0x05, // Block #5
}
actual, err := d.MarshalBinary()
assert.NoError(t, err)
assert.Equal(t, expected, actual)
}
func TestUnmars... |
3da91425c6b3e6003f5e94779f583fe3503ad081 | d3eb72aaeb05e61b57634a220d2ecd406078bb21 | dlorenc/build-pipeline | /pkg/apis/pipeline/v1beta1/task_validation_test.go | Go | go | 26,327 | permissive | /*
Copyright 2019 The Tekton 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... |
70736937baa78fc32809e3584c03ab1e086b8d15 | fff82b80574c5b3cd472fab2782e11c67977e0fa | tomha-magenic/write-docker-actions | /.github/actions/hello-world/main.go | Go | go | 441 | permissive | package main
import (
"fmt"
"os"
)
func main() {
// Access Inputs as environment vars
firstGreeting := os.Getenv("INPUT_FIRSTGREETING")
secondGreeting := os.Getenv("INPUT_SECONDGREETING")
thirdGreeting := os.Getenv("INPUT_THIRDGREETING")
// Use those inputs in the action logic
fmt.Println("Hello " + firstG... |
702844cfa7dcac256d0b4ec9982dc20feab5b34b | cb9c9c6848f3df8afe8dd3cd2b2feceafb656106 | thorwolpert/aries-framework-go | /cmd/aries-js-worker/main.go | Go | go | 10,008 | permissive | // +build js,wasm
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"syscall/js"
"time"
"github.com/mitchellh/mapstructure"
"github.com/google/uuid"
"github.com/hyperledger/aries-framework-g... |
d1b108c8afc9ff68c46e27649b92e53a599d7bdc | 105051910b5c5ec9230fcfc50fd5d1354fe5412a | straumur/postgres_backend | /migration.go | Go | go | 1,541 | permissive | package postgres_backend
import (
"errors"
"fmt"
"sort"
"time"
)
type Migration struct {
filename string
content string
date time.Time
}
func (m Migration) String() string {
return fmt.Sprintf("%s at %s", m.filename, m.date)
}
type Migrations []Migration
func (m Migrations) Len() int { return len... |
cc7f8fa8eb6d91c5aae0263061f0653f9a94e012 | 811037ea2b559dfcf1dc71c52bf4926bca0f4717 | sssss38438/teleport | /lib/service/service.go | Go | go | 78,549 | permissive | /*
Copyright 2015-2019 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,... |
40b529820f8cabadc481637ae5cf5dce9f888ce4 | 1c6451b2b5aff0226a44e4268306e5b94fb3f378 | jcbwlkr/kit | /examples/pool/main.go | Go | go | 2,383 | permissive | // Sample program to show how to use the pool package to build pools
// of goroutines to get work done.
package main
import (
"fmt"
"os"
"strconv"
"sync"
"time"
"github.com/ardanlabs/kit/cfg"
"github.com/ardanlabs/kit/log"
"github.com/ardanlabs/kit/pool"
)
// Configuation settings.
const (
configKey =... |
7c19c2704332063fbb293af92f4c4c1222fad73e | 977c1cb92839ab4a440eca69dfbc1ffdbb65ecc2 | theShadow89/goroslib | /pkg/protocommon/header_test.go | Go | go | 6,424 | permissive | package protocommon
import (
"bytes"
"fmt"
"io"
"reflect"
"testing"
"github.com/stretchr/testify/require"
)
type headerSubscriber struct {
Callerid string
Topic string
Type string
Md5sum string
MessageDefinition string
TcpNodelay int //nolint:golint
}
... |
2f65b3b8fc3b6a20ee94b9d95c9fa8d7c72e1f27 | 0be564d491e05e84924757959d2d3c6d3124276c | zaynetro/goraft | /raft.go | Go | go | 10,955 | permissive | package goraft
import (
"errors"
"fmt"
"log"
"math"
"math/rand"
"net/url"
"os"
"sync"
"sync/atomic"
"time"
)
const heartbeatInterval = 150 * time.Millisecond
var electionTimeoutRangeMillis = []int{150, 300}
type raft struct {
nodes map[string]*node
leaderID string
current *node
state *state
se... |
811172877d4931ed00624a64a8a3004565abfba7 | 9b63cc7f9509069de7f06c8059ecd20a24ba9240 | johanehnberg/lxd | /lxd/storage_volumes_state.go | Go | go | 4,696 | permissive | package main
import (
"context"
"fmt"
"net/http"
"net/url"
"github.com/gorilla/mux"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/lxd/instance"
"github.com/lxc/lxd/lxd/instance/instancetype"
"github.com/lxc/lxd/lxd/project"
"github.com/lxc/lxd/lxd/response"
storagePools "github.com/lxc/lxd/lxd/storage"
... |
944ac9ec4903c68c86c7516f19be7b545eb223a3 | 0fbfbe0685ea0fef4ca5b4705f72d5f9aeebe4b8 | TAIPANBOX/kubernetes | /pkg/scheduler/algorithm/predicates/csi_volume_predicate_test.go | Go | go | 17,851 | 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, ... |
999cd600b8f0a5a34358071cb105985f6f9510e1 | b9ac54d751f1cc7d782dde4c107efd6d4795b9f3 | fahadalisarwar1/tutorialsgolang | /Part_19_AdvancedFileHandling/P5_Directory_contents.go | Go | go | 385 | no_license | package main
import (
"fmt"
"os"
)
func main(){
dir, err := os.Open(".")
if err != nil{
fmt.Println("Unable to read directory")
return
}
defer dir.Close()
fileInfo, err := dir.Readdir(-1) // n limits the number of entries returned, -1 represents all entries
if err != nil{
fmt.Println("ERror")
return
... |
3333a39f5e9548d001d9758ade6355ce523e3cc9 | 68ce65014620c86db5e504ab1b248f859982f584 | zha0/ntfs | /bitmap.go | Go | go | 662 | permissive | package ntfs
import (
"bytes"
"strconv"
)
// Bitmap stores a series of bits.
type Bitmap []byte
// UnmarshalBinary unmarshals the little-endian binary representation
// of a bitmap attributre into bitmap.
func (bitmap *Bitmap) UnmarshalBinary(data []byte) error {
*bitmap = Bitmap(data)
return nil
}
// String re... |
5e4e28f46e3d5cfc83e24255b15d330d70d21c5d | 9af96f82a20e128137afcc64829697ea5e7b03c8 | nbabenko/tfchain | /vendor/github.com/threefoldtech/rivine/pkg/daemon/config.go | Go | go | 6,442 | permissive | package daemon
import (
"errors"
"fmt"
"strconv"
"github.com/spf13/pflag"
"github.com/threefoldtech/rivine/modules"
"github.com/threefoldtech/rivine/types"
"github.com/threefoldtech/rivine/pkg/cli"
)
const (
// RivineUserAgent is the user agent used by Rivine by default.
RivineUserAgent = "Rivine-Agent"
)
... |
00b6b989ffff9ebe9bd48daa9a95c6a61807455e | 1e3ab4619888468cfc1fc814b4c667681c61effd | ppd0705/10-week-algorithm-excercise | /Week_10 毕业总结/416/partition_equal_subset_sum.go | Go | go | 763 | no_license | package main
func canPartition(nums []int) bool {
if len(nums) < 2 {
return false
}
s := sum(nums)
if s%2 == 1 {
return false
}
target := s / 2
// dp[i][j] represent whether can select x numbers from nums[0:i+1] and their sum equals j
dp := make([][]bool, len(nums))
for i := 0; i < len(nums); i++ {
dp[... |
f6747e84ff296f1c4ddd8dd748fcb924d462940d | c5aabeb74e407b1e57c575437a89cfea039a2dee | dippynark/kube-qemu | /pkg/client/clientset_generated/internalclientset/typed/hypervisor/internalversion/generated_expansion.go | Go | go | 637 | no_license | /*
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, ... |
b01bd80851c5b1a7babe23845c71b68d76fbd6f1 | ecb79950190c0af00453b455ea49aa7601654c59 | georgi-bozhinov/golang-playground | /notes/controller.go | Go | go | 1,387 | permissive | package notes
import (
"encoding/json"
"github.com/gorilla/mux"
"log"
"net/http"
)
type NoteController struct {
Repository *NoteRepository
}
// NewNoteController creates a new note controller with a provided repository
func NewNoteController(repository NoteRepository) *NoteController {
return &NoteController{R... |
a6ca3086399a305fb6109297eca5a364016a1e82 | 65a1b6a4f1535110244f8c5cff7365b8e139a2fc | ozonva/ova-task-api | /internal/utils/slice_splitter_test.go | Go | go | 4,146 | no_license | package utils
import (
"github.com/stretchr/testify/assert"
"ozonva/ova-task-api/pkg/entities/tasks"
"reflect"
"testing"
)
func TestSplitSlice(t *testing.T) {
type args struct {
source []string
batch int
}
tests := []struct {
name string
args args
want [][]string
}{
{"empty source, butchSize > 0"... |
7098f92783e35d9db7f84e9f39f176b7ed0088a7 | 142c45806a35f2843fbcfa2bd64a5a53520d7bf0 | donaldsycamore/digitalwhanganui | /image.go | Go | go | 4,913 | permissive | package main
import (
"bytes"
"database/sql"
"image"
_ "image/gif"
"image/jpeg"
"image/png"
"io"
"log"
"net/http"
"time"
"github.com/nfnt/resize"
"digitalwhanganui/martini"
"digitalwhanganui/render"
)
func uploadImage(r render.Render, req *http.Request) {
//r.Status(500)
//return
var d struct {
Id... |
81cf17f23f33b06001c995127aa60828f83a3841 | 0c0abb9feb9c5c02a4d943a0d70ec417189fe711 | wearedevx/keystone | /cli/pkg/client/auth/authservice_testing.go | Go | go | 473 | permissive | // +build test
package auth
import (
"github.com/wearedevx/keystone/api/pkg/models"
)
type AuthService interface {
Name() string
Start() (string, error)
WaitForExternalLogin() error
CheckAccount(account map[string]string) (bool, error)
Finish(pkey []byte, device string, deviceUID string) (models.User, string, ... |
07a2ef6c2fee589c6a586c4e48ad61ad108a357f | 0897b74e22aaf41773539b54e598204f6977e021 | jmccann/drone-artifactory | /artifactory/search.go | Go | go | 565 | permissive | package artifactory
import (
"github.com/jfrog/jfrog-client-go/artifactory/services"
"github.com/jfrog/jfrog-client-go/artifactory/services/utils"
)
type (
// SearchArgs are arguments for searching files
SearchArgs struct {
Path string
Recursive bool
}
)
func (a Artifactory) search(args SearchArgs) ([]... |
729805e352b9d46eaac35494d79846c62d38ff74 | cd37c7f0df54422629cacf51b06aaf58e63880c0 | 0401-7r011/cli | /command/common/help_command.go | Go | go | 11,167 | permissive | package common
import (
"fmt"
"math"
"strings"
"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/sharedaction"
"code.cloudfoundry.org/cli/command"
"code.cloudfoundry.org/cli/command/common/internal"
"code.cloudfoundry.org/cli/command/flag"
"code.cloudfoundry.org/cli/util/configv3... |
cd1149d316b65346ffebf278194014e0f9309859 | 3ba4c5b33d6f3feab1b380f0c7909a64084f7b32 | fishjar/go-translate | /main.go | Go | go | 828 | no_license | package main
import (
"flag"
"fmt"
"gotrans/trans"
"strings"
)
func main() {
const moreTip = "显示更详细的内容(仅英文单词有效)"
var showMore bool
flag.BoolVar(&showMore, "more", false, moreTip)
flag.BoolVar(&showMore, "m", false, moreTip)
flag.Parse()
args := flag.Args()
if len(args) == 0 {
fmt.Println("没有翻译内容")
}
w... |
f58c148acb9b50a9cca5279775a64956c6696006 | c696e2675966842ab10b4ca8e7751d34fe167079 | enow-dev/enow | /server/main.go | Go | go | 2,752 | permissive | //go:generate goagen bootstrap -d github.com/pei0804/goa-spa-sample/design
package server
import (
"net/http"
"os"
"github.com/deadcheat/goacors"
"github.com/enow-dev/enow/app"
"github.com/enow-dev/enow/controller"
"github.com/enow-dev/enow/design"
"github.com/enow-dev/enow/mymiddleware"
"github.com/goadesig... |
60a15954dc85f23800364709150ec69f5c1d6b9d | 83d01d1493c97810dde96de25c2c161a2412a40f | cemalkilic/shorten-club-api | /cmd/healthCheck.go | Go | go | 372 | no_license | package main
import (
"fmt"
"github.com/cemalkilic/shorten-backend/config"
"net/http"
"os"
)
func main() {
cfg, _ := config.LoadConfig(".")
res, err := http.Get(fmt.Sprintf("http://127.0.0.1:%s/healthcheckz", cfg.ServerPort))
if res != nil && res.StatusCode != 200 {
os.Exit(1)
... |
9d1793fbe2811998e51bc58fb535599391fff633 | d02a770326bd542266028f1396547f8f0875e853 | kighie/filego | /receiver/receiver_cli.go | Go | go | 787 | no_license | package receiver
import (
"os"
"fmt"
"flag"
"log"
"github.com/kighie/filego/common"
)
func ParseOptions() ReceiverConfig {
var conf ReceiverConfig
var confFile string
var bRec bool
flag.BoolVar(&bRec,"receiver",false, "Starts up Receiver mode.")
flag.StringVar(&confFile,"config","", "Configuration file")... |
3393793fd675f109d79408d80a7357d208414a31 | cf8ca1f01618823f977997c6bb9ee26d454fe61f | corkili/go-husky | /internal/api/account_book_req.go | Go | go | 720 | no_license | package api
type AccountBook struct {
Id uint `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
type CreateOrUpdateAccountReq struct {
Id uint `json:"id"`
Datetime string `json:"datetime"`
Type string `json:"type"`
Money float64 `json:"money"`
Description string `json:"descriptio... |
a4faf54ead40d4b8a04d9fec8a9e34713f9bb803 | 1417d038a75cf303dd3c8af11f7907b97a6877e6 | kevinlowrie/kubernetes | /pkg/client/unversioned/request_test.go | Go | go | 38,504 | permissive | /*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
ac330c268ae2e296e15267176afad2512e7cd6e7 | a7b02865ec0a427ecefa51039c3fbb102a23be6a | teramono/engine-db | /cmd/server.go | Go | go | 479 | no_license | package main
import (
"log"
"github.com/teramono/engine-db/pkg/server"
"github.com/teramono/utilities/pkg/setup"
)
func main() {
// Establish common setup.
setup, err := setup.NewCommonSetup()
if err != nil {
log.Panic(err)
}
// Create server.
server, err := server.NewDBServer(setup)
if err != nil {
l... |
8236d5fb970098b41c3252eb2a2fda28a3ef9469 | 7177d9f78f2dbf731cc966d05444af14983ebb14 | okpub/dekopon | /actor/message.go | Go | go | 892 | no_license | package actor
//class
type ActorMessage struct {
sender PID
message interface{}
}
func (env *ActorMessage) Sender() PID { return env.sender }
func (env *ActorMessage) Message() interface{} { return env.message }
//static message func
func MSG(message interface{}) MessageEnvelope {
return WrapMessage(mes... |
54c764587cdb81a0f9ad5a99137070eef9aab48a | 04c691a0d57b986bf1208e1ebe75e53fd9db0187 | intellg/int-algorithms | /tesla/interview_20201013.go | Go | go | 1,399 | no_license | package main
import (
"fmt"
)
type Input struct {
Path string
Name string
}
func (i *Input) getDeep() (counter int) {
for _, c := range i.Path {
if c == '/' {
counter++
}
}
return
}
func (i *Input) getPathName() string {
return i.Path + i.Name
}
func main() {
input := []Input{
{"/a/b/c/", "e.txt"}... |
692d7e1891e29b53171c72896c4f102c2bd1746d | b4c455dcbdecea67d7e412a7afaf98c438e9f0e0 | displague/machine-api-operator | /pkg/operator/sync.go | Go | go | 22,857 | permissive | package operator
import (
"fmt"
"time"
"github.com/golang/glog"
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
"github.com/openshift/library-go/pkg/operator/resource/resourcehash"
"github.com/openshift/library-go/pkg/operator/resource... |
0243dfbc24aebda9b67cb4223a47043541a7c51a | dc7d967091ab3fdede046cd3e3b841cd71c88e12 | a20351766/udo1.3 | /core/comm/util_test.go | Go | go | 6,872 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package comm_test
import (
"context"
"crypto/tls"
"crypto/x509"
"sync/atomic"
"testing"
"time"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/udo/common/util"
"github.com/hyperledger/udo/core/comm"
grpc_testdata... |
cccce2840ca740936aa10288f07c5184e29c6297 | 380c974d06360162f2fea32124491ad79a04ccc4 | ahmad8746/DecisionMaker | /main.go | Go | go | 2,748 | no_license | package main
import (
dt "DecisionMaker/decisiontree"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/labstack/echo"
)
func LoadTree(c echo.Context) error {
file, _ := ioutil.ReadFile("treedb.json")
data := dt.TreeNodes{}
err := json.Unmarshal([]byte(file), &data)
if err != nil {
fmt.Prin... |
7b0845989f530fa6d9a65ca9753b23463ddad3a0 | d6e723c8cee5d2ed7052496951aa48376115911d | AuroraShine/Satellite | /unpack/unpack_base64.go | Go | go | 20,312 | permissive | package unpack
import (
"bytes"
"encoding/base64"
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime"
. "satellite/global"
. "satellite/utils"
"strings"
"sync"
"sync/atomic"
)
func UnpackBase64(src string, dest string) (err error) {
wg := &sync.WaitGroup{}
// start multi-cpu
core := runtime.NumCPU()
runt... |
ea8fa7eba94aaa06c53983eec8428012bbb3f1bd | fdb829d76a0510f8e3d6762f1e57de00700fe910 | Cepave/open-falcon-backend | /common/service/owl/query.go | Go | go | 3,908 | permissive | package owl
import (
"net/http"
"strconv"
"time"
"github.com/juju/errors"
"github.com/satori/go.uuid"
gt "gopkg.in/h2non/gentleman.v2"
"github.com/Cepave/open-falcon-backend/common/db"
oHttp "github.com/Cepave/open-falcon-backend/common/http"
"github.com/Cepave/open-falcon-backend/common/http/client"
"gith... |
d48d63c4a06cd896135dab253815bef5a97b76b9 | d8ece435e28a868d5b8fe5d5db7215f7dbf093d9 | Yisaer/tidb | /ddl/column.go | Go | go | 74,834 | permissive | // Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.