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 |
|---|---|---|---|---|---|---|---|---|
74a609300e22bd07bf2bc92516e00ce7a1148fef | c6d33dcb6928cbfa204f3ee32d862a82877f3689 | mikebochenek/learning | /go/aoc2021/day10.go | Go | go | 3,039 | no_license | package main
import (
"bufio"
"fmt"
"os"
"sort"
)
const FILENAME = "day10-1"
const size = 90
func main() {
f, err := os.Open("/home/mike/Documents/aoc/" + FILENAME + ".txt")
if err != nil {
fmt.Println(err)
}
defer f.Close()
scanner := bufio.NewScanner(f)
scanner.Split(bufio.ScanWords)
var lines = 0
... |
ac65cce4e185526f21663887fca5d42b1688110f | 9e2bfe2cb049b929534f37f1841ff8fe242b547d | Feng2012/golang-02-homework | /lesson3/binggan/str.go | Go | go | 540 | permissive | package main
import "fmt"
type Student struct {
Name string `json:"name"`
}
func reverse(s string) string {
s1 := []rune(s)
// 翻转数组s1
s2 := make([]rune, len(s1))
for i := 0; i < len(s1); i++ {
s2[i] = s1[len(s1)-i-1]
}
return string(s2)
}
func main() {
doc := `
hello world
即使换行也不影响\n
`
fmt.Print(doc)
s... |
bf9aa219de1754daec0ea1d7ad2dbb9fb057df9b | e2536bef12c52feac0300cdfeaa2b30a3a232a83 | eve-sec/goesi | /esi/model_post_universe_ids_inventory_type.go | Go | go | 1,072 | permissive | /*
* EVE Swagger Interface
*
* An OpenAPI for EVE Online
*
* OpenAPI spec version: 1.7.2
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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... |
5b21a7264feb717e9ec2793aa9d3741bf3b4d481 | d6694e306a11bc01fcdafb990e1aaf0a25934f6f | mengqingshare/studygolang | /websites/code/studygolang/src/api/article.go | Go | go | 512 | permissive | // Copyright 2014 The StudyGolang Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// http://studygolang.com
// Author:polaris studygolang@gmail.com
package api
import (
"fmt"
"net/http"
"service"
)
func AddArticleHandler(rw http... |
0de333731a42db5d64ecb4711c98b1f8764c7810 | 723a591bca77a7019a183f06d9e640422a321b1d | orbs-network/orbs-network-go18 | /test/testify_extensions.go | Go | go | 2,445 | no_license | package test
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/orbs-network/orbs-spec/types/go/protocol"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"reflect"
"strings"
"testing"
)
func AssertCmpEqual(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...... |
f6d84f0ce3b04a9e4741a9d684ee83b6723af260 | a4597be1d527d5084ff274f010afef01d762a237 | bruth/playbill | /cli/log.go | Go | go | 296 | no_license | package cli
var logUsage = `
usage: playbill log [<play>] [<act>] [<scene>]
View the detailed activity log of runs. A play, act, or scene can
be specified to limit the scope of the log.
`
var LogCmd = &Cmd{
Name: "log",
Short: "View the activity log",
UsageString: logUsage,
}
|
077bc5dedbb9a3cc97d92f00f6fcc12cdd2b92b4 | f05365c5c5b591c7fba35c1071062a0f6af13678 | pulumi/pulumi | /pkg/backend/filestate/meta_test.go | Go | go | 5,810 | permissive | // Copyright 2016-2023, 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... |
b8e9710829281dfa14e3104c87fa33c049297b54 | 17691f685a85d250135530f19a64352800974837 | dewey363/cobra | /server/db/access.go | Go | go | 1,018 | permissive | package db
import (
"database/sql"
)
func init() {
//Register access implation to Factory
RegisterFactory(DB_TYPE_ACCESS, NewAccess)
}
// CobraAccess is a implation for CobraDB to operation Access
type CobraAccess struct {
CobraADODB
}
// NewAccess
func NewAccess(host string, port int, user, password string, db... |
153174c738de0f21bd58ac002687173106bb5fcb | a7d4baf558651d3cee12ec0f9a45f2c3b56257c7 | PinkDiamond1/dnode | /cmd/dncli/cli_upgrade.go | Go | go | 573 | permissive | package main
import (
sdkClient "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeCli "github.com/cosmos/cosmos-sdk/x/upgrade/client/cli"
"github.com/spf13/cobra"
"github.com/tendermint/go-amino"
)
func GetUpgradeTxCmd(cdc *amino.Codec) *cobra.Command {
txCmd := &cobra.... |
a7799be8801b9b22002229834e5dbc1c3a052eed | 7d40493cf307540f9b61c6036b1ecae6cc86e089 | zachholcomb/go_practice | /hello_world/hello_test.go | Go | go | 308 | no_license | package greeting
import "testing"
func TestHelloWorld(t *testing.T) {
expected := "Hello, World!"
if observed := HelloWorld(); observed != expected {
t.Fatalf("HellowWorld() = %v, want %v", observed, expected)
}
}
func BenchmarkHelloWorld(b *testing.B) {
for i:=0; i < b.N; i++ {
HelloWorld()
}
} |
aafc7586c5d208a4fe2d0c6be3aed16c93eeecfb | 5b7c3049457aa374350612754f89bada4c311e1f | hf97542/eagle.tunnel.go | /src/eagletunnel/eagleuser.go | Go | go | 4,897 | permissive | package eagletunnel
import (
"container/list"
"errors"
"fmt"
"strconv"
"strings"
"sync"
"time"
"github.com/eaglexiang/eagle.lib.go/src"
)
// EagleUser 提供基本和轻量的账户系统
type EagleUser struct {
ID string
Password string
lastIP string // 上次登陆IP
lastTime time.Time // 上次检查登陆IP的时... |
a206a093758e706d1479fbbbc80673f239ef11a5 | d35e99f2e4c7669d9309458f6c88ee9e4c238189 | hzxuzhonghu/kubernetes | /pkg/kubectl/cmd/describe_test.go | Go | go | 8,380 | 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, ... |
df3f29f75131a591d4e5c29695b062839fa6d06f | 9d1fbafff8a7b1d0385bb26746deeb862bd56670 | lucas7788/ConsumerSdk | /forward/http.go | Go | go | 3,705 | no_license | package forward
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"strings"
"time"
"github.com/zhiqiangxu/ont-gateway/pkg/metrics"
)
const (
// defaultTimeout is default timeout for api request
defaultTimeout = 30 * time.Second
)
var (
client = &http.Client{Timeout: defaultTimeout, Transport: &http.Transport{Id... |
42d1b788a8d2835ff249c5de8a35557237012cb8 | e01df25face3dfd18f0b9c912402a24b4733c0af | aiyaya188/transcode | /userver.go | Go | go | 1,622 | no_license | package main
import (
"net/http"
"./controlers"
//"./models"
// "fmt"
//"os/exec"
// "bytes"
//"io/ioutil"
// "net/url"
)
func main() {
/* temp := "abcde/data/sbc.mp4"
temp1 := common.ReplaceFileType(temp, "m3u9")
fmt.Println("replace res:" + temp1)
*/
/*
subtitle,color,size,startpost := models.G... |
eea0df06dcfa19da21e7577e7d49e82c53ca1dc5 | 4f57116410b98cbad4872d8f4122b984d1434458 | ego008/selenium | /command_test.go | Go | go | 1,892 | permissive | package selenium
import (
"fmt"
"os"
"os/exec"
"strings"
"testing"
"time"
)
// fakeExecCommand is a replacement for `exec.Command` that we can control
// using the TestHelperProcess function.
//
// For more information, see:
// * https://npf.io/2015/06/testing-exec-command/
// * https://golang.org/src/os/exec/e... |
1abf43258e1aa9a77f8557e5e727df908447a56a | cfb756d9dde32f1d1cacc1e0b41db6658128fa6f | jangocheng/go-elasticsearch | /typedapi/types/nlpberttokenizationconfig.go | Go | go | 2,189 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
99e45b0af7fc6b15de887560ff8b99fe1e2bf550 | 84759af06cab57e9277d7d84986700f65f2dd261 | ljian1992/aftership-sdk-go | /impl/impl_test.go | Go | go | 7,607 | permissive | package impl
import (
"fmt"
"github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert"
"github.com/vimukthi-git/aftership-go/apiV4"
"net/http"
"testing"
//"time"
)
func TestMain(m *testing.M) {
httpmock.Activate()
m.Run()
httpmock.DeactivateAndReset()
}
func TestGetCouriers(t *testing.T) {
exp := ... |
1924b3f838934a6a16268eb8dd7caaaaf89e69d3 | 97919f37075c0ab9a13b72fff0225bb4c2ccc306 | hhjpin/gse | /server/server.go | Go | go | 2,319 | permissive | /*
gse 分词服务器同时提供了两种模式:
"/" 分词演示网页
"/json" JSON 格式的 RPC 服务
输入:
POST 或 GET 模式输入 text 参数
输出 JSON 格式:
{
segments:[
{"text":"服务器", "pos":"n"},
{"text":"指令", "pos":"n"},
...
]
}
测试服务器见 http://gse.weiboglass.com
*/
package main
import (
"flag"
"fmt"
"io"
"log"
"runtime"
"enc... |
f7c4ada996c68d531eb5d148a9365e52fd5eb81f | d35b7cddd09e98b31f669f06ea162f009f15d334 | tacklehop/csvsearch | /cs.go | Go | go | 1,806 | no_license | package main
import (
"encoding/csv"
"errors"
"flag"
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
flag.Parse()
searchCsv(flag.Arg(0), flag.Arg(1))
}
func searchCsv(uri, searchWord string) error {
if strings.HasPrefix(uri, "http") {
return searchCsvFromHttp(uri, searchWord)
} else {
return sea... |
07ddd570962c921b79fcbbf6de63a78795148574 | 98dc7e55705e958f6cd2b2fb7f445a752cfd1ec4 | rishikeshbedre/kafka-client | /main.go | Go | go | 4,337 | no_license | package main
import (
"log"
"os"
"time"
"kafka-client/consumer"
"kafka-client/producer"
"github.com/Shopify/sarama"
)
func main() {
sarama.Logger = log.New(os.Stdout, "[sarama] ", log.LstdFlags)
var syncproducerClient producer.KafkaProducerSync
syncproducerClient, clientErr := producer.CreateSyncProducer([... |
e9a452dafd66b6d62279d59c49c90e715a197c7e | 48ca843333795fbd97394ffe6a109268bedc26c8 | Waterdrips/arkade | /cmd/update.go | Go | go | 920 | permissive | // Copyright (c) arkade author(s) 2020. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func MakeUpdate() *cobra.Command {
var command = &cobra.Command{
Use: "update",
Sho... |
835f075ec04ba64cea5fad7dd026f62943b7309c | 85d29ded98107b12a70dbc4177254100bba889a0 | aws/amazon-cloudwatch-agent | /tool/processors/migration/windows/windows_migration_test.go | Go | go | 1,343 | permissive | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT
package windows
import (
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/amazon-cloudwatch-agent/tool/processors/defaultConfig"
"github.com/aws/amazon-cloudwatch... |
20c000f88a34947cd8f84eeb632d4421186233e4 | 56cc3e9cb911c0b3468bfd480bdd0cea44a33be8 | trafficstars/fasthttp | /pprofhandler/pprof.go | Go | go | 1,411 | permissive | package pprofhandler
import (
"net/http/pprof"
rtp "runtime/pprof"
"strings"
"github.com/trafficstars/fasthttp"
"github.com/trafficstars/fasthttp/fasthttpadaptor"
)
var (
cmdline = fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Cmdline)
profile = fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Profile)
symbol = ... |
781ac9ef40d6515456062593458d0f05e32c8381 | c693030a9bc7965515c8eaef5288f5a3df13d4ce | GauthierHacout/golang_algorithms | /tests/kthSmallestInBST_test.go | Go | go | 1,220 | no_license | package tests
import (
"../algorithms"
"../tester"
"testing"
)
func TestKthSmallestInBST(t *testing.T) {
test := tester.Tester{T: t}
tables := []struct {
input1 *algorithms.TreeNode
input2 int
expected interface{}
}{
{algorithms.BSTfromSlice([]int{3,1,4,2}), 1, 1},
{algorithms.BSTfromSlice([]i... |
83be43699073640f320b42d395eefe890838cb99 | 48778e0d81750f5f2caf05fb84426beb7560be7d | freeformz/swfsm | /activity/dispatchers.go | Go | go | 2,074 | permissive | package activity
import "github.com/awslabs/aws-sdk-go/service/swf"
//ActivityTaskDispatcher is used by the ActivityWorker machinery to dispatch the handling of ActivityTasks.
//Different implementations can provide different concurrency models.
type ActivityTaskDispatcher interface {
DispatchTask(*swf.PollForActivi... |
341e4508e5cbcd80de0b8968fd7677552684404c | 178273adf150b256716e0193c74aad4aeeccb048 | lllichen/jvmgo | /ch06/instructions/conversions/i2x.go | Go | go | 1,211 | no_license | package conversions
import (
"jvmgo/ch06/instructions/base"
"jvmgo/ch06/rtda"
)
type I2L struct {
base.NoOperandsInstruction
}
func (i2l *I2L) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
i := stack.PopInt()
l := int64(i)
stack.PushLong(l)
}
type I2F struct {
base.NoOperandsInstruction
}
fun... |
ee3f4cf4d9acfeb9fb4dca7b8155fed88cebdf5e | ccc4f1d88a7996d3c2addde8df90871a5c7b9647 | wonleing/kubevirt | /pkg/virt-api/webhooks/validating-webhook/admitters/vmi-create-admitter_test.go | Go | go | 145,434 | permissive | /*
* This file is part of the KubeVirt project
*
* 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 la... |
ceb8cd315defdaab7ae14d2ba225a61adeaaa5c9 | 6a053b269cc58d1b8d186f1896b46ccdc6a46be1 | ryan-beisner/aistore | /ais/auth.go | Go | go | 4,389 | permissive | // Package ais provides core functionality for the AIStore object storage.
/*
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
*
*/
// Package ais provides core functionality for the AIStore object storage.
// Authentication flow:
// 1. If AuthN server is disabled or directory with user credentia... |
92d19d491ab05a0cd396cde77246fc74fe5f61bd | ed72a516328f2a405c9cacf48cde97aa8eb9662a | vmware/alb-sdk | /go/models/gslb_geo_location.go | Go | go | 811 | permissive | // Copyright 2021 VMware, Inc.
// SPDX-License-Identifier: Apache License 2.0
package models
// This file is auto-generated.
// GslbGeoLocation gslb geo location
// swagger:model GslbGeoLocation
type GslbGeoLocation struct {
// Geographic location of the site. Field introduced in 17.1.1. Allowed in Enterprise editi... |
7de26ec1ea3c0e85ab38404e261db0469e4d5b9a | 1e9d6c32710249437a4bbf78651e706e79795a30 | shenqidebaozi/kratos | /transport/grpc/server_test.go | Go | go | 3,385 | permissive | package grpc
import (
"context"
"crypto/tls"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware"
"google.golang.org/grpc"
"net/url"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
type testKey struct{}
func TestServer(t *testing.T) {
ctx := context.Backgroun... |
c73cbe6b7316973f5a602d176ab94b191f7deb7f | d4af69321e5db2ba5e5bf6739dd527f5ea9e12c0 | cinic0101/go-sqlconn | /config.go | Go | go | 482 | permissive | package sqlconn
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type DBConfig struct {
Databases map[string]Database `yaml:"databases"`
}
type Database struct {
Driver string
Host string
Database string
User string
Password string
}
func UnmarshalConfig(filename string) (*DBConfig, error) {
c := &DBConfig{}
b... |
55640dfe08b4fc4fd237e5af54c1196edc12e9a0 | 0255b319d9bc846ba76306af270f7f2a515849e4 | JiangZhaoYang/porter | /vendor/github.com/docker/cnab-to-oci/remotes/fixuphelpers.go | Go | go | 3,661 | permissive | package remotes
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/remotes"
"github.com/deislabs/cnab-go/bundle"
"github.com/docker/distribution/reference"
"github.com/opencontainers/go-digest"
ocischemav1 "github.com/opencontainers... |
8ba0f81b04add00f3bf0d3bf51f6c936b9f5788d | c526a4d543595e9338879a0d3f9fa45967e8290c | isabella232/addons-firebase-testlab | /vendor/github.com/gobuffalo/buffalo/render/plain.go | Go | go | 946 | permissive | package render
// Plain renders the named files using the 'text/html'
// content type and the github.com/gobuffalo/plush
// package for templating. If more than 1 file is provided
// the second file will be considered a "layout" file
// and the first file will be the "content" file which will
// be placed into the "la... |
c47ca28d19d9a4caa7de90a9f8a625d7b1ab140a | 32bd5db2224ec1ecb03940ac28b9c67a1057c036 | ssubedir/goriffin | /protos/server/server.go | Go | go | 388 | permissive | package server
import (
"context"
"time"
protos "github.com/ssubedir/goriffin/protos/service/protos"
)
type Service struct {
}
func NewService() *Service {
return &Service{}
}
func (c *Service) HeartBeatStatus(ctx context.Context, req *protos.StatusRequest) (*protos.StatusResponse, error) {
return &protos.Sta... |
ec9a8e9c3cf797f5eeaf1339c7ac3e5214392ca0 | 9114b3ca478a8a246f9fe1e92f9a70d031300fab | rancher/local-path-provisioner | /vendor/github.com/Sirupsen/logrus/text_formatter.go | Go | go | 3,732 | permissive | package logrus
import (
"bytes"
"fmt"
"runtime"
"sort"
"strings"
"time"
)
const (
nocolor = 0
red = 31
green = 32
yellow = 33
blue = 34
gray = 37
)
var (
baseTimestamp time.Time
isTerminal bool
)
func init() {
baseTimestamp = time.Now()
isTerminal = IsTerminal()
}
func miniTS() int ... |
81403182503d9cd368e7b360b26554fc875f93d7 | 888a9f145df43844b7981d4f430eeec7697c9838 | philevans/go-chart | /defaults.go | Go | go | 6,141 | permissive | package chart
import (
"sync"
"time"
"github.com/golang/freetype/truetype"
"github.com/wcharczuk/go-chart/drawing"
)
const (
// DefaultChartHeight is the default chart height.
DefaultChartHeight = 400
// DefaultChartWidth is the default chart width.
DefaultChartWidth = 1024
// DefaultStrokeWidth is the defa... |
9968fbc5c0ddb3787bd4828039db1e5b5c028448 | 34fefbd76aa1b9586454c47ae5b8d9e0373461f8 | RaBhushan/tfsec | /internal/app/tfsec/rules/aws086.go | Go | go | 3,677 | permissive | package rules
import (
"fmt"
"github.com/tfsec/tfsec/pkg/result"
"github.com/tfsec/tfsec/pkg/severity"
"github.com/tfsec/tfsec/pkg/provider"
"github.com/tfsec/tfsec/internal/app/tfsec/hclcontext"
"github.com/tfsec/tfsec/internal/app/tfsec/block"
"github.com/tfsec/tfsec/pkg/rule"
"github.com/tfsec/tfsec/i... |
0edd14b6cedd73690f410ee8aca4d012e6f2341f | 9e85a5a8a66040787e7afb50dfdc695a94297023 | jeefy/osde2e | /vendor/github.com/openshift-online/ocm-sdk-go/accountsmgmt/v1/registry_credential_client.go | Go | go | 9,172 | permissive | /*
Copyright (c) 2019 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 to in writing, software... |
82461dab320648ec1b8159f573a243b1e4bdab70 | 31756d7f9f96a7cdc2910dc9e87f15e54f23e618 | igomez10/Algorithms | /cracking-the-code-interview/ArraysAndStrings/1.2CheckPermutation/checkPermutation_test.go | Go | go | 411 | no_license | package main
import "testing"
func TestCheckPermutation(t *testing.T) {
isPermutation := []string{
"abcdefghi",
"ihgfedcba",
}
if !checkPermutation(isPermutation[0], isPermutation[1]) {
t.Errorf("Expected true got false")
}
isNotPermutation := []string{
"asdfasdflb",
"falkklasdd",
}
if checkPermutat... |
d5138d2fb244b00b461d4b831db1cb04e9efa47a | 21d8adf4d2f802f1218d5f5a9d5caa49c46050b4 | my10c/procfs-go | /procfs_disk.go | Go | go | 5,505 | permissive | // Copyright (c) 2017 - 2017 badassops
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions an... |
a30021f9d13d3dd1af35dc1dee1f7083e42e022f | 80f682fb83db64a5415a96626ebb080af10ea489 | bianjieai/irita-sdk-go | /crypto/armor.go | Go | go | 6,282 | permissive | package crypto
import (
"encoding/hex"
"fmt"
"github.com/pkg/errors"
"github.com/tendermint/crypto/bcrypt"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/armor"
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric"
cryptoAmino "github.com/bianjieai/irita-sdk-go/cry... |
2d8ef28a10427e3f07960848785bc315393ad7df | 17916a04e1db02c37cb1c6abfa1301617a903033 | cloudflare/cloudflared | /socks/connection_handler_test.go | Go | go | 2,022 | permissive | package socks
import (
"encoding/json"
"io"
"net"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/assert"
"golang.org/x/net/proxy"
)
type successResponse struct {
Status string `json:"status"`
}
func sendSocksRequest(t *testing.T) []byte {
dialer, err := proxy.SOCKS5("tcp", "127.0.0.1:8086", nil,... |
c878b07ac610d34b5d386d2d3b8d39df1a2d285e | 177cad01a6a8d9e2066fdedc9d7c9d3ed037344d | lawrencegripper/kube-azcon | /vendor/camlistore.org/dev/devcam/appengine.go | Go | go | 3,486 | permissive | /*
Copyright 2013 The Camlistore 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,... |
217f2a4050035b073ce643ea5392ee791480651d | 3c515bce9a9c66ae194000ef913c2a4005b44c12 | JieTrancender/iv-promotion | /apps/pflag-test/main.go | Go | go | 468 | permissive | package main
import (
"fmt"
"github.com/spf13/pflag"
)
var flagvar int
var newFlagVar int
func main() {
pflag.IntVar(&flagvar, "flagVar", 0, "flag var")
pflag.IntVar(&newFlagVar, "newFlagVar", 0, "flag var")
pflag.Parse()
fmt.Println("flagvar has value ", flagvar)
newFlagVar, err := pflag.CommandLine.GetInt... |
07fecede20f6b48ed809ba70e38ee90af229f61f | 62732b62485e9dc39e86404127f300a7ae5af817 | dancannon/gonews | /Godeps/_workspace/src/github.com/robertkrimen/otto/type_function.go | Go | go | 8,857 | permissive | package otto
type _functionObject struct {
call _callFunction
construct _constructFunction
}
func (self0 _functionObject) clone(clone *_clone) _functionObject {
return _functionObject{
clone.callFunction(self0.call),
self0.construct,
}
}
func (runtime *_runtime) newNativeFunctionObject(native _nativeFun... |
2304f685a5909253f0425ccb54e405a0ef85d543 | b2bd369ec91491d369486b48bcad5b28dfd4b1bc | go-st/epilog | /logger_test.go | Go | go | 5,746 | no_license | package epilog
import (
"github.com/go-st/logger"
. "gopkg.in/check.v1"
)
type LoggerTestSuite struct {
handler *testHandler
logger *Logger
}
var (
_ = Suite(&LoggerTestSuite{})
)
func (s *LoggerTestSuite) SetUpTest(c *C) {
s.handler = &testHandler{Level: logger.LevelDebug}
s.logger = New("test", s.handler)... |
3d3465eea9dbb3498ccb28bedffde607a905d505 | 6cc2be10de3ad3de54eede556926c80682d144fc | myimilo/x | /parser/html_parser.go | Go | go | 6,983 | permissive | package parser
import (
"errors"
"github.com/crawlerclub/x/types"
t "github.com/lestrrat/go-libxml2/types"
"github.com/robertkrimen/otto"
"strings"
"time"
)
type HtmlParser struct {
Name string
}
type DOMNode struct {
Name string // always start with name root
Node interface{}
Item map[string]interface{}
}... |
a2fd1db3461c3af00edcefb94acd32fd106d6081 | c781def6af79f07e16bb21a6053094865f8aad85 | Smarp/GoOse | /extractor.go | Go | go | 19,342 | permissive | package goose
import (
"container/list"
"github.com/advancedlogic/goquery"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"
"gopkg.in/fatih/set.v0"
"log"
"math"
"net/url"
"regexp"
"strconv"
"strings"
)
const defaultLanguage = "en"
var motleyReplacement = "�"
var escapedFragmentReplacement = reg... |
18898c79bcb5f3cd1e308d1c5ec269b31015504b | bc604c35404aa7527c77e50a04fcf8986a0592ae | oleh-ozimok/minikube-nfs | /main.go | Go | go | 1,092 | permissive | package main
import (
"fmt"
"os"
log "github.com/Sirupsen/logrus"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
debug = kingpin.Flag("debug", "Enable debug mode.").Short('d').Bool()
nfsConfig = kingpin.Flag("nfs-config", "NFS configuration to use in /etc/exports.").Default(fmt.Sprintf("-alldirs -mapall=... |
529ecc92530ae7bd2431506296585ee662d8e804 | 392cdc79c7a3fdb44304387a9d378a2a27cfa5b8 | mParticle/mparticle-go-sdk | /events/model_product_action.go | Go | go | 1,652 | permissive | package events
// ProductAction struct for ProductAction
type ProductAction struct {
Action ProductActionType `json:"action"`
CheckoutStep *int64 `json:"checkout_step,omitempty"`
CheckoutOptions string `json:"checkout_options,omitempty"`
ProductActionList string `... |
9244f1e56cd222f1c4e40f05ce451f4295b4aa97 | 89a4d4267a563e6f5078137f886451c928801569 | jimjh/octopi | /go/src/octopi/run/broker/subscribe.go | Go | go | 1,549 | no_license | package main
import (
"code.google.com/p/go.net/websocket"
"io"
"octopi/api/protocol"
"octopi/impl/brokerimpl"
"octopi/util/log"
)
// consumer handles incoming subscribe requests. Consumers may send
// multiple subscribe requests on the same persistent connection. However,
// consumers may only subscribe to the ... |
f27062151cb439ac98d1aedb3a38f2188840b779 | 0adcabb95e988ca57e692ef7f86273aa2f4a2d58 | vestival/cerbos | /internal/observability/tracing/tracing.go | Go | go | 2,637 | permissive | // Copyright 2021 Zenauth Ltd.
// SPDX-License-Identifier: Apache-2.0
package tracing
import (
"context"
"fmt"
"strings"
"contrib.go.opencensus.io/exporter/jaeger"
"go.opencensus.io/trace"
"github.com/cerbos/cerbos/internal/config"
"github.com/cerbos/cerbos/internal/util"
)
var conf Conf
func Init() error ... |
8b5c36e262955d03212c367ea60098df75af41e6 | d58daa9b878216784757c8a330554103b1965a7c | PyGoJs/server | /misccmd/checkin.go | Go | go | 1,218 | no_license | package main
// Used for checking a person in, without having to Curl.
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"github.com/pygojs/server/util"
)
func main() {
name := flag.String("n", "", "name of student")
clid := flag.String("c", "AjuSY$U9e", "client id")
flag.Parse()
asser... |
1a9326271514dd1e703048fe85ffdd248988c0d5 | 87cfedcda48e607701bc77cb315dae15040809a3 | rlpeck/rules_sqlc | /tests/features/table_names/table_names_cleaned_test.go | Go | go | 908 | permissive | // Copyright 2020 Plezentek, 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 applicab... |
8ff694f227dde1ed87e345b2fbf6000858c1deea | 63b2654a7af3e6acfd23302a029ec88af4f964a3 | yokeiju/x10 | /webapps/controllers/base.go | Go | go | 7,075 | no_license | package controllers
import (
. "eaciit/x10/webapps/connection"
_ "eaciit/x10/webapps/helper"
. "eaciit/x10/webapps/models"
"fmt"
"log"
"math"
"net/http"
"strconv"
"strings"
"time"
db "github.com/eaciit/dbox"
"github.com/eaciit/knot/knot.v1"
"github.com/eaciit/orm"
tk "github.com/eaciit/toolkit"
)
type ... |
6cf947445f0e97fbf1d3863a8125fc692f618909 | de94f18be5b30c1112ee9ddd51cd2d2a12271cee | iamseki/go-idiomatic | /hello.go | Go | go | 273 | no_license | package main
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/iamseki/go-idiomatic-001/morestrings"
)
func main() {
fmt.Println("Hello Idiomatic GO !")
fmt.Println(morestrings.ReverseRunes("!oG ,olleH"))
fmt.Println(cmp.Diff("Hello World", "Hello Go"))
}
|
855037c25254a22d9d55caf29ab92ad5b57370ee | b693661084dad67a452d526aa18f58ed5ed52935 | hihus/falls | /store/exp/dbm/array.go | Go | go | 11,389 | no_license | // Copyright 2014 The dbm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dbm
import (
"fmt"
"io"
"store/exp/lldb"
)
// Array is a reference to a subtree of an array.
type Array struct {
db *DB
tree *lldb.... |
58556c3d053e84d31354e30f42f80f28879a3ac8 | f764b485c0d4066cda503707767721294973aa3d | EvilChan/GolangStudyCode | /day08/06tcp_demo/client/main.go | Go | go | 516 | no_license | package main
import (
"bufio"
"fmt"
"net"
"os"
"strings"
)
// tcp client
func main() {
// 1.与server端建立连接
conn, err := net.Dial("tcp", "127.0.0.1:20000")
if err != nil {
fmt.Println("dial 127.0.0.1:20000 failed,err:", err)
return
}
// 2.发送数据包
reader := bufio.NewReader(os.Stdin)
for {
fmt.Println("向服... |
f87172023fe18747d5cd60ed15d86c2c14c3459c | 119a59f3dbc6b4c986ef5f54e1dda45915c14fe9 | antham/yogo | /internal/cmd/inbox_delete.go | Go | go | 976 | permissive | package cmd
import (
"fmt"
"github.com/antham/yogo/v4/internal/client"
"github.com/spf13/cobra"
)
var inboxDeleteCmd = &cobra.Command{
Use: "delete <inbox> <offset>",
Short: "Delete email at given position in inbox",
RunE: inboxDelete(newInbox[client.MailHTMLDoc]),
Args: cobra.ExactArgs(2),
}
func inboxD... |
affe22cf2ce11ff23e2cb22e4f44955d305a3542 | ac6e72e414b6918742c74476922666dcdebaf8e4 | Panlq/Go-Project | /go-gin-ex/pkg/util/pagination.go | Go | go | 468 | no_license | /*
* @Author: panlq01@mingyuanyun.com
* @Date: 2020-10-12 16:29:01
* @Description: Some desc
* @LastEditors: panlq01@mingyuanyun.com
* @LastEditTime: 2020-10-13 18:42:32
*/
package util
import (
"go-gin-ex/pkg/setting"
"github.com/gin-gonic/gin"
"github.com/unknwon/com"
)
func GetPage(c *gin.Context) int {... |
10286607e62cfd50f51b2e7ba7e936d509d64441 | d2d4056145daa3d69664002442a9e118d7164e6e | phongvu0403/library-management | /migrations/1569247400_add_returned_history.go | Go | go | 289 | no_license | package migrations
import migrate "github.com/rubenv/sql-migrate"
func init() {
instance.add(&migrate.Migration{
Id: "1569247400",
Up: []string{
`
ALTER TABLE book_history
ADD COLUMN returned boolean DEFAULT false;
`,
},
//language=SQL
Down: []string{
},
})
}
|
52f50beb0c5888273eec700f46bfdeef32f1cf2f | 442b32e2e892c9e69588ea9178368c2a9e455295 | Gungniir/skillbox | /Module 7/Task 4/main.go | Go | go | 430 | permissive | package main
import (
"fmt"
)
func main() {
fmt.Println("Программа максимальное количество билетов, которое нужно купить, чтобы точно получить счастливый билет")
last := 100001
max := 1
for i := 100002; i <= 999999; i++ {
if i%1000 == i/1000 {
if max < i-last {
max = i - last
}
last = i
}
}
... |
3ccbee7ac611db4433e02c1305024d52080f0707 | a8f8caeafa5ad3d19ba21512d9cd0988dbbb0f4b | France-ioi/AlgoreaBackend | /app/api/groups/update_permissions.go | Go | go | 28,500 | permissive | package groups
import (
"net/http"
"time"
"github.com/France-ioi/validator"
"github.com/go-chi/render"
"github.com/jinzhu/gorm"
"github.com/France-ioi/AlgoreaBackend/app/database"
"github.com/France-ioi/AlgoreaBackend/app/domain"
"github.com/France-ioi/AlgoreaBackend/app/formdata"
"github.com/France-ioi/Alg... |
e3cdbd926140002f62280f59eb1c2d308d108a08 | 08ab43413e6ecf54e640afa03fcd6b0c9f3af6b9 | znkeeez/go-test | /web2/create.go | Go | go | 1,235 | no_license | package main
import (
// ビルド時のみ使用する
"database/sql"
"log"
_ "github.com/mattn/go-sqlite3"
)
// DB Path(相対パスでも大丈夫かと思うが、筆者の場合、絶対パスでないと実行できなかった)
const dbPath = "db.sql"
// コネクションプールを作成
var DbConnection *sql.DB
func main() {
// Open(driver, sql 名(任意の名前))
DbConnection, _ := sql.Open("sqlite3", ... |
2765beb3dd62263354930fea0eeccb2119383702 | ce8352130e58db3bb44d2f5e6aa857344b68101f | mickydelfavero/mover | /mover.go | Go | go | 6,651 | no_license | // mover
// (C) 2019 Micky Del Favero micky@BeeCloudy.net
package main
import (
"flag"
"io/ioutil"
"log"
"log/syslog"
"os"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/BurntSushi/toml"
"github.com/fsnotify/fsnotify"
)
var watcher *fsnotify.Watcher
type tomlConfig struct {
Movall bool
Source s... |
7127be592f4cbec556e1cfe71890cea3a83565a9 | 93b729ed35366e9b83b8808cb1dd35661231d80b | chriskillpack/dns | /main.go | Go | go | 4,241 | no_license | package main
import (
"bufio"
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"math/rand"
"net"
"os"
"strings"
)
const (
PORT = 3030 // Port to listen on
)
// DNS query classes
const (
IN = 1
ANY = 255
)
// DNS header flags
const (
FLG_RESPONSE = 1 << 15
FLG_RECURSION_DESIRED = 1 << 8
FLG_R... |
4f6981eefa2bfd7ebb4ae2d07519d23df44b45b0 | 22d6e733c1d0b87ff22a0bf3998e649c0e2ba0df | fossabot/federation-dns | /vendor/github.com/kubernetes-sigs/federation-v2/pkg/client/clientset_generated/clientset/typed/federation/v1alpha1/fake/fake_federatedsecretoverride.go | Go | go | 5,980 | permissive | /*
Copyright 2018 The Federation v2 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 writin... |
fb5727a21edd162744c2398e7856786396ae4067 | 15cf4fba25a84afde5f78adb5c45994865dd803c | balmiusf/Coding-Problems | /Facebook/problem2.go | Go | go | 861 | no_license | /*
Given an array of integers, write a function to determine whether the array could become non-decreasing by modifying at most 1 element.
For example, given the array [10, 5, 7], you should return true, since we can modify the 10 into a 1 to make the array non-decreasing.
Given the array [10, 5, 1], you should retur... |
9eacc2a4ddd5829aeda6d46660eeec4c3c1587c2 | a7b036ec15afc1edc54e9fa4ea9c63b9cace53d6 | mikebd/cockroach | /client/client_test.go | Go | go | 20,107 | permissive | // Copyright 2014 The Cockroach 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... |
8fc61ec55c88a47a2ddb9c7ededee271f09c65b7 | 4b22e4fe2419eaa1a9f36c3ab86322d639b24080 | ronaldoveras/go-labs | /interfaces/interfaces.go | Go | go | 542 | no_license | package main
import (
"fmt"
)
type t interface {
area()
volume()
}
type item struct {
radius float64
height float64
}
type fake struct{}
func (m item) area() float64 {
return 2*m.radius*m.height +
2*3.14*m.radius*m.radius
}
func (m item) volume() float64 {
return 3.14 * m.radius * m.radius * m.height
}... |
d72397f8a5643640903032ab3727152cebaa0012 | 87b87dd74bba987613979f3797d43b134872db3a | kubeforge/gardener-extensions | /controllers/provider-gcp/pkg/webhook/controlplanebackup/add.go | Go | go | 2,580 | permissive | // Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
080a6566f5b9451d5834e33d7e564fd72d2b92aa | 9c7463551da507c3d6dd7c591098cb00fcb92101 | atomix/atomix | /logging/logger.go | Go | go | 12,006 | permissive | // SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>
//
// SPDX-License-Identifier: Apache-2.0
package logging
import (
"fmt"
"os"
"runtime"
"strings"
"sync"
"sync/atomic"
)
var root Logger
const pathSep = "/"
const atomixDebugEnv = "ATOMIX_DEBUG"
func init() {
confi... |
b9c2fa26a36cc34352b95dfe4f7fdb6125a618b5 | 6dd608fc620592e617783c88c3f08fcc06be2e8c | robarchibald/aggregator | /aggregator.go | Go | go | 7,558 | permissive | package main
import (
"archive/zip"
"bufio"
"encoding/xml"
"fmt"
"github.com/PuerkitoBio/goquery"
"github.com/garyburd/redigo/redis"
"github.com/robarchibald/configReader"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strings"
"sync"
)
type aggregator struct {
RedisServer string
Red... |
67cdcad1eb9bf0ac35e6922d9fe6d715523be37b | 496bed7ca2da5d54f3df4a642aec7c9bd720fa89 | rewattpower/fabric | /msp/mgmt/mgmt_test.go | Go | go | 3,832 | permissive | /*
Copyright IBM Corp. 2017 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 agreed to in wri... |
66a431e00610e42defedc2fb1147eb9d15b503ad | a9bc10a5932da8385dd74d936a5a469323c1d142 | aleshchynskyi/kube-mysql | /controllers/config.go | Go | go | 1,444 | no_license | package controllers
import (
"context"
mysqlalpha1 "github.com/vellanci/kube-mysql.git/api/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
)
func (r *MysqlClusterReconciler) GetClusterConfig(ctx context.Context, cluster *mysqlalpha1.MysqlCluste... |
90b2463e8d7d37c578a7eba804678e0f189de509 | 7bbb380209a8a8d8fb8d1c283ea502b8cc8c39c1 | sjfbjs/kubedashadmin | /pkg/util/pagination.go | Go | go | 274 | permissive | package util
import (
"github.com/gin-gonic/gin"
"github.com/unknwon/com"
"gin-vue/pkg/setting"
)
func GetPage(c *gin.Context) int {
result := 0
page, _ := com.StrTo(c.Query("page")).Int()
if page > 0 {
result = (page - 1) * setting.PageSize
}
return result
}
|
38ddaf337611a638d481f3c60a7e78f5ea30b4fa | 74b2815fa8292577d405e48473361006b4d33974 | aliffrhn/Go-ogle | /tipe-data.go | Go | go | 657 | no_license | package main
import "fmt"
func main(){
// Positif
var number_positif8 uint8 = 255 //0-255
var number_positif16 uint16 = 65534 //0-65535
var number_positif32 uint32 = 4000000 //0-4294967295
var number_positif64 uint64 = 400000000000 //0-
fmt.Println(number_positif8)
fmt.Println(number_positif16)
fmt.Println(... |
ba67ebba97eeff348257cdc7004ffcf841ece3e3 | 54fb28da53e8a3f4ce337cd79acba918f6964336 | gnagel/nginx-config-formatter | /formatter/formatter.go | Go | go | 2,212 | permissive | package formatter
import (
"fmt"
"github.com/pkg/errors"
"io/ioutil"
"log"
"strings"
"time"
)
type Fmt struct {
Indent string
ConfigFile string
CreateBackup bool
InPlace bool
Verbose bool
}
func (self *Fmt) Run() error {
// Read in the file
if self.Verbose {
log.Println("Reading source file: ",... |
10b50185876f115a7b704c3fdac1590dd6161824 | dbf82e466b5cf25ea717da283d5bc4487408475d | guos930112/Go-ginPro | /routers/router.go | Go | go | 394 | no_license | package routers
import (
"github.com/gin-gonic/gin" // 引入需要的gin包
"ginPro/controllers/health"
"ginPro/controllers/users"
)
func CollectRoute(r *gin.Engine) *gin.Engine {
// 2.绑定路由规则,执行函数
r.GET("/", health.IndexRedirect)
r.GET("/ping", health.HealthTest)
r.GET("/long_async", health.LongAsync)
r.POST("/api/auth/... |
227bdda0b597834530f2e423a5c815ac7525ead1 | b2ff4a563e7819343c2f32f58945a4bdf5114054 | michaelcity/OneSignal | /onesignal.go | Go | go | 846 | permissive | package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://onesignal.com/api/v1/notifications"
post := "{\"app_id\": \"9c8d3f26-33c1-4874-b179-7e416c006000\"," +
"\"included_segments\": [\"All\"]," +
"\"data\": {\"foo\": \"bar\"}," +
"\"headings\": {\"en\": \"你好\"}," +
"... |
8a0d27f0d506ee56a226b3b75e4e5ba56051dda0 | ddf559ae5bed266b59f3fe268063bf956e72403b | weilain/frp | /pkg/plugin/client/http2https.go | Go | go | 2,512 | permissive | // Copyright 2019 fatedier, fatedier@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 applicable law... |
986e38dee1434122fb26e49108fc4a3f384eb780 | a728b5ccca7ee2726a58f5c26ee305391079e35b | hoongeun/gogoatalk | /client/client.go | Go | go | 1,585 | permissive | package main
import (
"context"
"errors"
"fmt"
"log"
"net"
"net/url"
"github.com/Hoongeun/gogoatalk/client/app"
"github.com/Hoongeun/gogoatalk/common"
"github.com/Hoongeun/gogoatalk/common/util"
"github.com/spf13/cobra"
)
func main() {
var (
flagPort int
flagHost string
)
var rootCmd = &cobra.Comman... |
26df66d86f66e18e2a30e80f907c6bc44b74c07e | edb285acd4907fec4e0b400e7af31f5ae457aef6 | wertycn/code_version_tool | /service/crond.go | Go | go | 328 | permissive | package service
import (
"log"
"time"
)
func CrontabFunc(d time.Duration, handler func(), desc string) {
for {
log.Println("crontab func runing ", desc)
handler()
time.Sleep(d)
}
}
func Crond() {
time.Sleep(time.Second * 5)
go CrontabFunc(time.Second*30, SaveVersionMap, "持久化发布版本数据到本地")
}
|
7ef834de0e537ebc27374f329e9dd02364a34070 | 05128faaa98d0fc49f3f78cf3c1a74d0ce52f8c6 | dianqiji/contrail | /pkg/agent/handler.go | Go | go | 3,956 | permissive | package agent
import (
"fmt"
"strings"
"github.com/Juniper/asf/pkg/logutil"
"github.com/Juniper/asf/pkg/models/basemodels"
"github.com/Juniper/contrail/pkg/cloud"
"github.com/Juniper/contrail/pkg/deploy"
"github.com/Juniper/contrail/pkg/services"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
type m... |
e8b027ad8a29af0cb5de3ed0974cc2bf1a1403a4 | 7d083ff2b64a7f752c5fd2e121088f8320db768e | dhanielsales/golang-course | /7 - Structs 2/main.go | Go | go | 364 | no_license | package main
import "fmt"
type people struct {
firstName string
lastName string
age int16
}
type student struct {
people
grade int8
}
func main() {
student1 := student{people: people{"Felipe", "Castro", 20}, grade: 20}
fmt.Println(student1)
fmt.Println(student1.firstName)
fmt.Println(student1.peopl... |
e26846ac2d96de31d7a7636d2420bede697cc0fd | aa8dfc3ed9db3910152a2f0e881aa71b9af573cf | bpkgoud/pulumi-azure-native | /sdk/go/azure/compute/v20210401/getImage.go | Go | go | 1,317 | permissive |
package v20210401
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupImage(ctx *pulumi.Context, args *LookupImageArgs, opts ...pulumi.InvokeOption) (*LookupImageResult, error) {
var rv LookupImageResult
err := ctx.Invoke("azure-native:compute/v20210401:getImage", args, &rv, opts...)
if err != ni... |
b4bb1bf5658ce3498ae3df9431b03314eb7b09a0 | 8c9cfacb31841ccb5d1a27cf41dc3862f346f2a5 | wenfengsui/http-bench | /bodys.go | Go | go | 1,366 | permissive | package main
import (
"bufio"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"log"
"math/rand"
"os"
"time"
)
func ParseSiteSkc(filename string) map[string][]string {
csvFile, _ := os.Open(filename)
reader := csv.NewReader(bufio.NewReader(csvFile))
ret := make(map[string][]string, 4)
for {
line, error := rea... |
69e830261194b4d7b274bf3e395780dd67ceef8e | 1cc91717e7fd10992c15a29da222587dacb78f56 | silsuer/bingo-log | /example/main.go | Go | go | 1,902 | permissive | package main
import (
"github.com/silsuer/bingo-log"
"fmt"
"os"
)
func main() {
//log := bingo_log.NewLog(bingo_log.LogPoolMode)
//log.SetPoolExpiredTime(100)
//log.SetPoolWorkerNum(100)
log := bingo_log.NewLog(bingo_log.LogSyncMode)
//e := new(ExampleConnector)
//log.LoadConnector(e)
//config := make(m... |
38094272232d353fba68c70de13a90c30eca3ee3 | 03f494327684648db5161c72b35d891dc6fba85e | kyma-project/examples | /http-db-service/internal/repository/memory.go | Go | go | 1,568 | permissive | package repository
import (
"fmt"
)
type orderRepositoryMemory struct {
Orders map[string]Order
}
// NewOrderRepositoryMemory is used to instantiate and return the DB implementation of the OrderRepository.
func NewOrderRepositoryMemory() OrderRepository {
return &orderRepositoryMemory{Orders: make(map[string]Orde... |
9e525e2f5440d458c5cd71692ac178283e5a62b3 | 14a0ca0e376ee2642107fe2b7c3c832687106d05 | WalkerLiuFei/Elasto | /p2p/msg/filterclear.go | Go | go | 415 | permissive | // Copyright (c) 2017-2019 The Elastos Foundation
// Use of this source code is governed by an MIT
// license that can be found in the LICENSE file.
//
package msg
import (
"github.com/elastos/Elastos.ELA/p2p"
)
// Ensure FilterClear implement p2p.Message interface.
var _ p2p.Message = (*FilterClear)(nil)
type Fi... |
2d8b7838b14a58a743f5480302e65976563e7a89 | b82d25d4f98cedf4051306b1833589879b5545b6 | hyperledger/fabric | /vendor/github.com/IBM/idemix/bccsp/schemes/dlog/bridge/revocation.go | Go | go | 2,182 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package bridge
import (
"crypto/ecdsa"
bccsp "github.com/IBM/idemix/bccsp/schemes"
idemix "github.com/IBM/idemix/bccsp/schemes/dlog/crypto"
math "github.com/IBM/mathlib"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"... |
211edf6e5a5daab7bc41db26be5f9a313197734e | ec45b7ddf605064c059f710d38fdb69326c0021c | PaaS-TA/Service-release | /paasta-mysql-release/src/github.com/sclevine/agouti/matchers/internal/selection/have_attribute_test.go | Go | go | 3,009 | no_license | package selection_test
import (
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sclevine/agouti/matchers/internal/mocks"
. "github.com/sclevine/agouti/matchers/internal/selection"
)
var _ = Describe("HaveAttributeMatcher", func() {
var (
matcher *HaveAttributeMatcher
selection ... |
39feb57d9710de4749a07e4745237443d17f06aa | d7cae340e7d7feafc50cb1c12d5a74f6a8988c0c | JesusIslam/limap | /limap_test.go | Go | go | 1,033 | permissive | package limap_test
import (
"testing"
"time"
"github.com/JesusIslam/limap"
"github.com/stretchr/testify/require"
)
func TestLimap(t *testing.T) {
var l *limap.Limap
t.Run("When new default", func(t *testing.T) {
l = limap.New(0, 0, 0, 0, 0)
require.NotNil(t, l)
})
t.Run("When new valid", func(t *testin... |
24e5a0c8e3b644682198358afb20f60d0d68aece | 1f0ec7b406d52d9ea5790f8a71becf6532db63bc | phsiao/tulipindicators-go | /indicators/decay.go | Go | go | 1,053 | permissive | package indicators
//#include "../tulipindicators/indicators/decay.c"
import "C"
import "fmt"
// DECAY function wraps `decay' function that provides "Linear Decay"
//
// Reference: https://tulipindicators.org/decay
func DECAY(real []float64, period int) (decay []float64, err error) {
input_length := len(real)
optio... |
51a99b08f7b0419edb6a881cec922010dd877601 | bc0965cf75a23bbbfc0e9eda5fa103a59c7e33e6 | ethersphere/tokenexporter | /tokenexporter/main.go | Go | go | 5,471 | no_license | package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"math/big"
"net/http"
"os"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)
var (
allWatching []*Watching
data string
port string
upd... |
9aaf226067739b2740ec7221dcdab53c8c9e2e55 | 44df54606fe2f06a08f0f7973b3ced24b359f8bc | puneetv05/hoard | /core/storage/logging_store.go | Go | go | 1,761 | permissive | package storage
import (
"encoding/base64"
"fmt"
"github.com/go-kit/kit/log"
"github.com/monax/hoard/core/logging"
)
type loggingStore struct {
store NamedStore
logger log.Logger
}
// Decorates a Store with some simple logging of method/address pairs
func NewLoggingStore(store NamedStore, logger log.Logger)... |
0d0e3d3571849e2afa458a47fd2011625858ea0e | 21b8c268841023755bd1435f7753a0945064bb1d | flaper87/installer | /terraform/providers/aws/vendor/github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator/endpoint_group.go | Go | go | 12,647 | permissive | package globalaccelerator
import (
"fmt"
"log"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/globalaccelerator"
"github.com/hashicorp/aws-sdk-go-base/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema... |
fb8393f0fadcb369ff6ac51ee8ab4a6d69d74ec6 | 7f97811da99111a20796260aafb1eac6c7cd59ad | BrianCarducci/DiscordBot | /services/m8b/m8b.go | Go | go | 633 | no_license | package m8b
import (
"errors"
"math/rand"
"strings"
"github.com/bwmarrin/discordgo"
)
var answers = []string{
"It is certain.",
"Not even close baaabyyy.",
"Naaaaah",
"idk bruh",
"Yuh",
"Probs",
"Not in a milly yearz",
}
func M8b(s *discordgo.Session, m *discordgo.MessageCreate, args []string) (error) {
... |
b02b4405e233170f250cb5854b2f71420b75ae12 | 71d5a41000a2c8f3ddd2509cf8076786a3c4f4b9 | muharihar/oci-go-sdk | /applicationmigration/list_migrations_request_response.go | Go | go | 7,941 | permissive | // Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
e6d3d7a20227470288228dc5ac04b976e52975d3 | 638e113cb254d7e7436f5cc28c3dd40764749d12 | jansemmelink/msf | /lib/micro/domain.go | Go | go | 2,464 | no_license | package micro
import (
"fmt"
"reflect"
"sync"
"github.com/jansemmelink/msf/lib/log"
)
//IDomain ...
type IDomain interface {
Sub(n string) IDomain
GetSub(n string) IDomain
GetSubs() map[string]IDomain
Add(m IMicro)
AddName(n string, m IMicro)
Get(n string) IMicro
Opers() map[string]IMicro
}
type domain ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.