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 |
|---|---|---|---|---|---|---|---|---|
63c3119f4005ca3fcdf7fb9f65910a0519e8d5fa | 3b9520928e6b9143febed9e4bf029de8460297aa | degville/lxd | /lxd/storage_mock.go | Go | go | 6,358 | permissive | package main
import (
"io"
"github.com/gorilla/websocket"
"github.com/lxc/lxd/lxd/migration"
"github.com/lxc/lxd/lxd/state"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/ioprogress"
"github.com/lxc/lxd/shared/logger"
)
type storageMock struct {
storageShared
}
func (s *storageMock) StorageCore... |
ca5ecba2669aa62b928d9685ff038cb31e4cd9f9 | 33de9af47bb25ff21d02f980b39809606ce74d92 | jtaleric/installer | /pkg/types/validation/installconfig.go | Go | go | 6,388 | permissive | package validation
import (
"fmt"
"net"
"sort"
"strings"
"k8s.io/apimachinery/pkg/util/validation/field"
"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/aws"
awsvalidation "github.com/openshift/installer/pkg/types/aws/validation"
"github.com/openshift/installer/pkg/types... |
ca54bfd8fda0ac9d3b03d2b84c099c6239927046 | 17cf735123cd528b30d22202775b383d19b885d3 | hmike96/shippy-service-consignment | /main.go | Go | go | 2,294 | no_license | // shippy-service-consignment/main.go
package main
import (
"context"
"log"
"net"
"sync"
// Import the generated protobuf code
pb "github.com/hmike96/shippy-service-consignment/proto/consignment"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
const (
port = ":50051"
)
type repository interf... |
07bdfc7802c3d5a5b6ba865025d8dde0cf4e9f5a | 4c3d3aa42d9107dded4f75c1a90e63f9cea538e9 | sudachen/go-spacemesh | /state/statedb_test.go | Go | go | 5,469 | permissive | // Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
f80f6779d46d8d37f3cda4b334352a7f0082d9ab | 1c70cf8ce8451cc8f6fb9aed600a9503cee8ed9e | fengzxu/fcc | /appcode/fccserver/src/db/tbservice.go | Go | go | 4,072 | permissive | /*
Copyright xujf000@gmail.com .2020. 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... |
0b312d0ef2d17d0dca346016ca7a56fef8538b32 | 55112f22d5e578f4a63cf79fa2a68437a3b68dee | jlauinger-mscthesis/gopass | /internal/backend/crypto/xc/encrypt_test.go | Go | go | 5,539 | permissive | package xc
import (
"bytes"
"context"
"crypto/rand"
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/gopasspw/gopass/internal/backend/crypto/xc/keyring"
"github.com/gopasspw/gopass/internal/backend/crypto/xc/xcpb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.go... |
baa5f23f73756d68f8c51f2c48cd7eef13394569 | 4fcfd846cb696229453c8a9ac345ae1866775a8b | gampeixoto/pdfjet | /src/pdfjet/pdf.go | Go | go | 44,071 | permissive | package pdfjet
/**
* pdf.go
*
Copyright 2020 Innovatics Inc.
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 and the foll... |
d01c2bc2e15c9ebd8dcee34a21818528ffa399ee | 1bb73523fa6460c3fa79a4e4358fab4880d24573 | petli-openshift/ocm-sdk-go | /clustersmgmt/v1/add_on_versions_client.go | Go | go | 13,075 | permissive | /*
Copyright (c) 2020 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... |
47133fd82d3562416b9348651e87958a68e2e029 | b023fddf6da09338a3f01091bb28936e5e236449 | zhangsongdmk/matrixone | /pkg/vm/engine/aoe/storage/layout/table/v1/factory.go | Go | go | 1,442 | permissive | // Copyright 2021 Matrix Origin
//
// 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 ... |
32cab29b85e7c2755080511cf759bdc5c290b468 | 75f769f63af35d5ab8952f9af00e03721b6bc03e | RTradeLtd/go-ipfs-plugin-i2p-gateway | /vendor/github.com/eyedeekay/sam3/I2PAddr.go | Go | go | 5,573 | permissive | package sam3
import (
"bytes"
"crypto/sha256"
"encoding/base32"
"encoding/base64"
"errors"
"io"
"strings"
)
var (
i2pB64enc *base64.Encoding = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~")
i2pB32enc *base32.Encoding = base32.NewEncoding("abcdefghijklmnopqrstuvwxyz2345... |
d8fbc4aed034a49fa8eae5ceb438821577d4fffa | 1f114b89de63464a34a9309bdedbc661757b5ab7 | huangyiminghappy/sofa-mosn | /pkg/upstream/cluster/cluster.go | Go | go | 15,765 | 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 ... |
fdd34326975a49c8be1d8def8a9a8838ab27da6d | dc3f77752292aa44acc9b11df88921a542cdee7d | fws433/go-learnmore | /jichuzhishi/context/context1.go | Go | go | 929 | no_license | package main
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"time"
)
//网络请求超时控制
type Result struct{
r *http.Response
err error
}
func main(){
process()
}
func process() {
ctx,cancel:=context.WithTimeout(context.Background(),2*time.Second)
//释放资源
defer cancel()
tr:=&http.Transport{}
client:=&http.Client... |
7e4dfa90f40a8ea0dfb3a26325b8f51b9cf08271 | 73d66c00d7a70c15e08dc1b6da002c9be0c433ae | fnproject/fn | /vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go | Go | go | 17,741 | permissive | // Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// +build sqlite_vtable vtable
package sqlite3
/*
#cgo CFLAGS: -std=gnu99
#cgo CFLAGS: -DSQLITE_ENABLE_RTREE
#cgo CFLAGS: -DSQLITE_THREADSAFE
#cgo... |
5b42f9e4ce0c4027750d72b821e98f176baea6ce | 581fe52948c67b2ef7ec8da21cd4ab1cbafa7537 | ichunt2019/gf | /os/glog/glog_api.go | Go | go | 3,609 | no_license | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/ichunt2019/gf.
package glog
// Print prints <v> with newline using fmt.... |
af45b40ca189a031d9c52aa7b9c4ecc72f5186ca | a75c40ff7958032a0d77b2a1dc67a2d1e998d10e | TanklesXL/FragCollector | /manipulatefragranceitems/structs.go | Go | go | 830 | permissive | package manipulatefragranceitems
// FragranceCollection is used to hold a collection of FragranceItems
type FragranceCollection struct {
MasterCollection map[string]FragranceItem
FragrancesByName []BasicInfo
FragrancesByHouse []BasicInfo
Notes map[string][]BasicInfo
}
// FragranceItem type contains ... |
3894e555e97a05d79409a98ea9de8dd886f9d2a4 | 9425533770dfafbe5058cacee453523bff7cee96 | tbarrella/serving | /test/util.go | Go | go | 1,888 | permissive | /*
Copyright 2018 The Knative 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, soft... |
34d24ac6255087f103e89aa0e4f11d0f6f05896f | a09bbeceab2dca1b7a5d5a681b6cff12b43110d9 | unmeshdesale/kubevirt | /pkg/api/v1/types_swagger_generated.go | Go | go | 5,564 | permissive | // Automatically generated by swagger-doc. DO NOT EDIT!
package v1
func (VirtualMachine) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.",
"spec": "VM Spec contains the VM spec... |
a38e0504aa1fea920ba48b7192a1d46dbc583d88 | b282f8460c97f41fe9d4bbc5b78b596d362daef3 | harryzzp/turtle | /utils/json/json.go | Go | go | 543 | no_license | package json
import (
"encoding/json"
"fmt"
)
func FreeType(theJson string) interface{} {
var anything interface{}
json.Unmarshal([]byte(theJson), &anything)
var ft interface{}
switch v := anything.(type) {
case float64:
fmt.Printf("NUMBER: %f\n", v)
ft = v
case string:
fmt.Printf("STRING: %s\n", v)
... |
4dbfc28bc7214c10867d8e5a5332a9cc90ffea05 | 17c05e8b4321b773874be9860a3e8b922784677e | goddamnbro/7_goroutine_mulitiplexer | /main.go | Go | go | 858 | no_license | package main
import (
"fmt"
"sync"
)
func MergeTwoChannels(ch1, ch2 chan int) chan int {
to := make(chan int, 100)
var group sync.WaitGroup
// reading from 1st chan
group.Add(1)
go func() {
for value := range ch1 {
to <- value
}
group.Done()
}()
// reading from 2nd chan
group.Add(1)
go func() {... |
6fad0c7d07ab0eb5a2cb14b76317cae5d4930025 | 751be36d09f9545b72c12aefd63095b2dbbcfdcc | apaqi/sharkstore | /master-server/server/node.go | Go | go | 12,021 | permissive | package server
import (
"sync"
"time"
"fmt"
"sync/atomic"
"model/pkg/metapb"
"golang.org/x/net/context"
"github.com/juju/errors"
"model/pkg/mspb"
"util/log"
)
var (
DefaultFaultTimeout = time.Minute
DefaultMaxBigTaskNum = 3
DefaultMaxTaskNum = 50
)
// TODO 机器不同导致的分片数量
type Node struct {
*metapb.Node
... |
9d7e6e91860593d9c219b7350443754bf90b7ff3 | 299dea836b5b33db5baec3a21048848951d5b1b9 | jamiepg1/pythia | /third_party/go.tools/go/pointer/example_test.go | Go | go | 3,077 | permissive | // Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pointer_test
import (
"fmt"
"sort"
"github.com/fzipp/pythia/third_party/go.tools/go/callgraph"
"github.com/fzipp/pythia/third_party/go.tools/go/lo... |
8d98b3be0c7100b0867058cbad92029269e3aecf | e40654a2370b5499221fbba042b4fe181e9e907e | Nliver/kwai-marketing-api | /model/tool/creative_word_list_request.go | Go | go | 575 | permissive | package tool
import (
"net/url"
"strconv"
)
// CreativeWordListRequest 获取可选的动态词包 API Request
type CreativeWordListRequest struct {
// AdvertiserID 广告主ID
AdvertiserID int64 `json:"advertiser_id,omitempty"`
}
// Url implement GetRequest interface
func (r CreativeWordListRequest) Url() string {
return "v1/tool/cre... |
9761b36b0c54cabaf8f48f26d158de22dbcf7547 | 22f6c5b4f9e9d2d511b3987d31fa002f66445f9c | YoungPioneers/huaweicloud-sdk-go | /functiontest/blockstorage/snapshots.go | Go | go | 7,579 | permissive | package main
import (
"encoding/json"
"fmt"
"github.com/huaweicloud/huaweicloud-sdk-go/functiontest/common"
"github.com/huaweicloud/huaweicloud-sdk-go"
"github.com/huaweicloud/huaweicloud-sdk-go/openstack"
"github.com/huaweicloud/huaweicloud-sdk-go/openstack/blockstorage/v2/snapshots"
)
func main() {
fmt.Pr... |
92f643751fb895291efa50352c78f9e29922d0f7 | 129f8c7e23ff14a1eaf456df6e336ae11bca0f44 | shihtzu-systems/bright | /generated/bungie/datax/report_reason_category.go | Go | go | 1,488 | permissive | package datax
import (
"bytes"
"encoding/json"
"fmt"
"github.com/shihtzu-systems/bright/generated/bungie/data"
"github.com/shihtzu-systems/bright/pkg/tower"
log "github.com/sirupsen/logrus"
)
func LoadReportReasonCategory(destiny *data.Content, redis tower.Redis, overwrite bool) {
log.Infof("ReportReasonCatego... |
0436c0e34faf4879cdfec4a7411ebe931c33e264 | c698e232aa3b5c8389732fbfc568e9c4d7f2355c | mabelenda/go-examples | /go_crash_course/018_challenges/03/Rodo/main.go | Go | go | 2,426 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"github.com/gorilla/mux"
)
type item struct {
ID int `json:"id,omitempty"`
Title string `json:"title,omitempty"`
IsDone bool `json:"isdone,omitempty"`
}
var items = []item{}
func homeEndpoint(w http.ResponseWrite... |
326e5b74632ca28522ce2f118f5ef8d7636bc672 | 08f1b565379e52bb0a6e079625335ef0a6a74764 | fearless11/alertbeat | /conf/alarm.go | Go | go | 513 | no_license | package conf
import (
"fmt"
"sort"
"strings"
)
type BasicAlert struct {
AlarmID string `json:"alarmid"`
Content string `json:"content"`
}
type LabelSet map[string]string
type T8TAlert struct {
Labels LabelSet `json:"labels"`
Annotations LabelSet `json:"annotations"`
}
func (l LabelSet) String() string ... |
bb012b58ee413115339cba696948ff339ed9d248 | 1c262debd5d1c7a160238898f768c683a242c94e | alyakubov/pki_blockchain_arch | /PKI_rep170622/pki-web.go | Go | go | 49,908 | no_license |
package main
import (
"html/template"
"time"
"fmt"
"io/ioutil"
"os"
"log"
"net/http"
"strings"
"strconv"
"math/big"
"hash/crc32"
cryptoRand "crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/gob"
"github.com/gorilla/mux"
"github.com/ethereum/go-eth... |
b56fe59e36fc5fac8e0880763288c4788c4cd041 | eea31d9309434463e6c69f655ee503d9f4e01e72 | golint-fixer/caddy-esi | /helper/strings_test.go | Go | go | 1,331 | permissive | // Copyright 2015-2017, Cyrill @ Schumacher.fm and the CoreStore contributors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Un... |
6a3065f739952c03deefbc69953f636bbca71647 | 2d4f7191b58bd8170ddfe81de2c798e51d965a3b | syndesisio/syndesis-operator | /pkg/util/resources.go | Go | go | 1,372 | no_license | package util
import (
"github.com/syndesisio/syndesis-operator/resources"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"github.com/operator-framework/operator-sdk/pkg/util/k8sutil"
"io/ioutil"
"strings"
"k8s.io/apimachinery/pkg/util/yaml"
)
func LoadKubernetesResource... |
616af4d4472d7cf16457840273e3cccc12b44aa3 | dbc0ba2e85c24dc5791fd73e68354bde078cbf8e | GoogleCloudPlatform/golang-samples | /spanner/spanner_snippets/spanner/spanner_create_database.go | Go | go | 2,059 | permissive | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
19280ff19b21e7c1dac81ef436fb6892ec604798 | 701e1386e6183db21517409ad32d09bb27e113dd | blitzlog/log | /config.go | Go | go | 2,110 | no_license | package log
import (
"fmt"
"github.com/blitzlog/proto/log"
)
type config struct {
logLevel log.Level // current log type
logVerbosity int32 // current log level
logJson bool // log as json
logLocal bool // log to stdout
apiKey string // API Key
apiError bool // AP... |
683c7dd93dfe16085689e74e65c49fbd76056297 | 68230352124cfbeaf3ca513ef4a54acece86f687 | monofone/harbor | /src/controller/artifact/processor/chart/chart_test.go | Go | go | 5,675 | permissive | // Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
c7833207a1d51b2900c577314d4571da72a39ddc | 457b92ebc90c390a358ebe92dca386b21ee1f7a2 | mfirmanakbar/bookstore_users-api | /controllers/users/users_controller.go | Go | go | 3,628 | no_license | package users
import (
"github.com/gin-gonic/gin"
"github.com/mfirmanakbar/bookstore_oauth-go/oauth"
"github.com/mfirmanakbar/bookstore_users-api/domain/users"
"github.com/mfirmanakbar/bookstore_users-api/services"
"github.com/mfirmanakbar/bookstore_utils-go/rest_errors"
"net/http"
"strconv"
)
func getUserId(u... |
46bd280a7757dbffd424336fdd401835056fabff | d6f726679055ed311d4269e5712f739fb7d49123 | eyedeekay/rain | /internal/piecepicker/piecepicker_test.go | Go | go | 1,870 | permissive | package piecepicker
import (
"testing"
"github.com/cenkalti/rain/internal/bitfield"
"github.com/cenkalti/rain/internal/peer"
"github.com/cenkalti/rain/internal/piece"
"github.com/stretchr/testify/assert"
)
const numPieces = 7
const numPeers = 3
func TestPiecePicker(t *testing.T) {
pieces := make([]piece.Piece... |
c46d95f229dd6b939aeae4bfd1db83e2afeff0db | 87b28ce32514398aee4c01678e7155e9e2d9b648 | bybzmt/asynctask | /statistics.go | Go | go | 2,233 | no_license | package main
import (
"fmt"
"time"
"unsafe"
)
type StatRow struct {
offset int
all int64
data []int64
}
func (s *StatRow) Init(num int) {
s.offset = 0
s.all = 0
s.data = make([]int64, 0, num)
}
func (s *StatRow) Push(val int64) {
if len(s.data) < cap(s.data) {
s.data = append(s.data, 0)
}
s.all ... |
23cf857893996c350f02a88563aa3de4a241115d | 74236d46c9d3f3e2533df3aef6b0ccf1986b13fd | iosifpeterfi/go-ipfs | /cmd/ipfswatch/main.go | Go | go | 4,425 | permissive | package main
import (
"context"
"flag"
"log"
"os"
"os/signal"
"path/filepath"
"syscall"
core "github.com/ipfs/go-ipfs/core"
corehttp "github.com/ipfs/go-ipfs/core/corehttp"
coreunix "github.com/ipfs/go-ipfs/core/coreunix"
config "github.com/ipfs/go-ipfs/repo/config"
fsrepo "github.com/ipfs/go-ipfs/repo/fs... |
23c69725b903624f7669a77f31627daa8b77baf6 | 1a20c2cbe372b26feee31cc1bdceb5c0d717793c | tianya888888/kubekey | /pkg/common/kube_action.go | Go | go | 1,154 | permissive | /*
Copyright 2021 The KubeSphere 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 wri... |
f01f292e9ec200294813aaacb2fd1b69657d5022 | 916030630308bdcbd5b8b5c7d178b3b25af3494b | alamehor/pachyderm | /vendor/go.pedge.io/protolog/text_marshaller.go | Go | go | 2,983 | permissive | package protolog
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"time"
"unicode"
"go.pedge.io/proto/time"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
)
var (
jsonPBMarshaller = &jsonpb.Marshaler{}
)
type textMarshaller struct {
options MarshallerOptions
}
func newTextMarsha... |
f92734cfb8f91a82f9d16e0cc85201f251dc4d04 | fa86db9e1e566647efff70fb1dd9cdd146f23027 | bububa/opentaobao | /model/aedata/AliexpressAffiliateOrderListbyindexAPIRequest.go | Go | go | 4,234 | permissive | package aedata
import (
"net/url"
"github.com/bububa/opentaobao/model"
)
// AliexpressAffiliateOrderListbyindexAPIRequest AE联盟推广者订单查询接口-按游标索引查询 API请求
// aliexpress.affiliate.order.listbyindex
//
// AE联盟推广者订单按游标查询接口
type AliexpressAffiliateOrderListbyindexAPIRequest struct {
model.Params
// 开始时间
_startTime strin... |
ebb7f99b9f6fd59be856773037018c6402f9c7ee | e54304d659e20ebf9c565596434f9386650028c5 | arnov17/go-explore | /nogung/p-32-json/01/01.go | Go | go | 390 | no_license | package main
import (
"encoding/json"
"fmt"
)
type User struct {
Fullname string `json:"Name"`
Age int
}
func main() {
var jsonString = `{"Name": "john wick", "Age": 27}`
var jsonData = []byte(jsonString)
var data User
var err = json.Unmarshal(jsonData, &data)
if err != nil {
fmt.Println(err.Error... |
a5e3a4d6396b156b68173dc8ec5532911f6db0e8 | 1c685721da600aeb83258326e40cad857ae91980 | michaelkruglos/tweek | /services/gateway/security/requestUtils_test.go | Go | go | 10,444 | permissive | package security
import (
"context"
"net/http"
"net/http/httptest"
"reflect"
"testing"
)
func TestExtractFromRequest(t *testing.T) {
type args struct {
r *http.Request
}
userInfo := &userInfo{
name: "A B",
email: "a@b.com",
sub: &Subject{User: "A b sub", Group: "default"},
}
tests := []struct {... |
121e6d7b4c03caa06a6785d4a4c0f9e0598e2150 | 9eda133bb8191c73f52e603c0317b05a2fc3ee6b | cfi2017/mute-bot | /internal/sniffer/config.go | Go | go | 359 | no_license | package sniffer
import (
"github.com/spf13/pflag"
)
func InitialiseFlags() {
pflag.StringP("device", "d", "eth0", "device to sniff")
pflag.String("guild_id", "", "guild id for muting")
pflag.String("report_endpoint", "http://localhost:8080/event", "reporting endpoint for bot auto muting")
pflag.IntP("server_port... |
700ddb325f2c9ebad74cd48210718e49bbbcb500 | c1eb1856905423bece22326d0b5d216a39c2e655 | AnanievNikolay/test_task | /usecase/price_request.go | Go | go | 982 | no_license | package usecase
import (
"encoding/json"
"log"
"reflect"
"github.com/AnanievNikolay/test_task/domain"
"github.com/AnanievNikolay/test_task/presentation/model"
)
//NewPriceRequest ..
func NewPriceRequest(_client domain.IClient) *PriceRequest {
return &PriceRequest{
client: _client,
}
}
//PriceRequest ...
ty... |
7dbd27aba5d3fa8e1254568a7ed03c776ed9f10b | aa84e83516ecbad7466b585e913ba23816b7cb48 | fsnakes/feedbot | /cmd/migrate/main.go | Go | go | 361 | permissive | package main
import (
"os"
"github.com/foxbot/feedbot"
)
func main() {
if _, err := os.Stat("data.db"); !os.IsNotExist(err) {
panic("databae already exists, please remove first")
}
println("migrating up...")
c, err := feedbot.NewController()
if err != nil {
panic(err)
}
err = c.CreateTables()
if err !=... |
83437ae820d1a8f0bbd78478a49908fc776444fb | 98b9e3c3c683d79203f84d39e7b4aa8786db267a | akbennett/edgex-go | /internal/core/metadata/const.go | Go | go | 4,449 | permissive | /*******************************************************************************
* Copyright 2017 Dell 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/licen... |
0636bedaf39e660497488527e8ee599ec5225d7a | 08149bf4a6ad9628c47db09a9db0b639794bd5be | e421083458/grpc-proxy-self | /examples/route_guide/mock_routeguide/rg_mock_test.go | Go | go | 2,202 | permissive | /*
*
* Copyright 2017 gRPC 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... |
28e279184fe93a0d04a1a0ad52036247779733da | 62c6f4c367aad2dc7412b7884c5c46ac1e6243f9 | Larrygf02/go-blog | /utils/token.go | Go | go | 1,597 | no_license | package utils
import (
"errors"
"fmt"
"log"
"strings"
"time"
"github.com/dgrijalva/jwt-go"
)
type JWTResponse struct {
Token string `json:"token"`
Refresh string `json:"refresh_token"`
}
var signKey = []byte("SECRET")
func CreateToken() (string, error) {
token := jwt.NewWithClaims(jwt.SigningMethodHS256... |
63e5142d28494e29cbc2b3be10a784509d86e9c6 | aa4467c307cb2f1f94928173f6a76b58f5b44d60 | ferretdayo/GraphQLSample | /src/entities/users.go | Go | go | 265 | no_license | package entities
import "time"
type User struct {
ID uint `gorm:"primary_key"`
DisplayID string `gorm:"unique;not null"`
IsUnsubscribed bool `gorm:"not null"`
CreatedAt time.Time
UpdatedAt time.Time
UserDetail UserDetail
}
|
948d0864c35ffddc5dce9e394dc042c86aacf02d | 08d10cf635e5e1729c23637c01a2ff213fa5c545 | jhh130910/golang | /pkg/06.variables/variable.go | Go | go | 337 | no_license | package main
import "fmt"
func main() {
var a = "initial"
var B string= "string ..."
fmt.Println(a)
fmt.Println(B)
var b, c int = 1, 2
fmt.Println(b, c)
var d = true
fmt.Println(d)
var e int
fmt.Println(e)
// declaring and initializing a variable
f := "short"
f... |
6672cdea38a94b8bbd81a444e96828ca517d7d85 | 7d5e280d1a72f1f8f9007301be600e829a34679c | kidmam/go-fluentd | /tagFilters/base.go | Go | go | 2,048 | permissive | package tagFilters
import (
"fmt"
"sync"
"github.com/Laisky/go-fluentd/libs"
"github.com/Laisky/go-utils"
"github.com/Laisky/zap"
"github.com/cespare/xxhash"
"github.com/json-iterator/go"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
type TagFilterFactoryItf interface {
IsTagSupported(string) bo... |
2476a8f738ea9360d7c38c0ebf07104a2415cde3 | a04095a7690bddc8c859bba3db7833916caa1b00 | puper/go-http-server | /endless/endless.go | Go | go | 5,690 | permissive | package endless
import (
"crypto/tls"
"log"
"net"
"net/http"
"openapi/listener"
"os"
"os/signal"
"runtime"
"sync"
"syscall"
"time"
)
const (
STATE_INIT = iota
STATE_RUNNING
STATE_SHUTTING_DOWN
STATE_TERMINATE
)
var (
DefaultReadTimeOut time.Duration
DefaultWriteTimeOut time.Duration
DefaultMax... |
26b1c04eaf0915914c082b5d355497630e463280 | 3528a64daef7c796195e815f91405f6cb19cc2b4 | arugal/mosn | /pkg/log/accesslog.go | Go | go | 4,498 | 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 ... |
fa2bb7cb23b8c4e18a8b5e5be26aee1445f2e027 | 913e24be32e1d870eef61b3898d2acb70b843f90 | jchavezlavalle/oathkeeper | /proxy/authenticator_oauth2_introspection_test.go | Go | go | 4,882 | permissive | /*
* Copyright © 2017-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* 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... |
6bcea59cf3bde59825cbdb55a4c04917a7bb40ab | 7867f14791cab26bf30475a82db202101f0e8ab1 | ztelur/etcd-3.4 | /tests/e2e/metrics_test.go | Go | go | 2,229 | permissive | // Copyright 2017 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
721b162793474454471df2619d6d5e100af4d922 | 7c0a450a24ec5241c400c1ca9832dee3471a6ca4 | jgengo/macinfo-client | /internal/gatherer/gatherer.go | Go | go | 4,578 | no_license | package gatherer
import (
"bytes"
"log"
"os/exec"
"regexp"
"strconv"
"strings"
"github.com/jgengo/macinfo-client/internal/utils"
)
// System stores the Mac system information
type System struct {
Token string `json:"token"`
Hostname string `json:"hostname"`
ActiveUser string `json:"active_u... |
b1f599a4b0f9e4260641c3c305230733c287adc5 | a325e3917960dc5090333926fb13145df1322c9c | upmc-enterprises/contrib | /ingress/controllers/gce/controller/fakes.go | Go | go | 2,506 | permissive | /*
Copyright 2015 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... |
2a6aad6f34645865b4180249bdc327bdb2d7a20a | 346a230cf6e77a599303c6cecb8f01cb1f88f1e4 | kagaya85/skywalking-satellite | /plugins/receiver/grpc/nativemeter/receiver.go | Go | go | 2,063 | permissive | // Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "Li... |
7a0b8b74dd81f476da8e9fb11a097c478aa7d6f5 | d3bf9be39d004440ddddc90dd8ffb4fa2762cad4 | carrigan223/intro_to_go | /07_pointers/code/exercise7.go | Go | go | 581 | no_license | package main
import "fmt"
type User struct {
ID int
FirstName, LastName, Email string
}
func changeEmail(email *string) string {
*email = "newEmail@gmail.com"
return *email
}
func main() {
user1 := User{
ID: 1,
FirstName: "Andrew",
LastName: "Carrigan",
Email: "carriga... |
ca2e1f514ebb6d314e8ac660d3e6ed62bf1a2b86 | 39cef575501f1d820ee4e73d56ee12a2b7849bb1 | koungkub/thoughtworks | /io/io.go | Go | go | 483 | no_license | package io
import (
"bufio"
"fmt"
"os"
"strings"
)
func Welcome() string {
return "Welcome to the game !!"
}
func Turn(predictor bool) string {
if predictor {
return "You are the predictor, what is your input ?"
}
return "AI is the predictor, what is your input ?"
}
func Scan(pattern string) string {
i... |
0fe2e21a287192d4f4c8eaf7d91644a7acd273b1 | 5b769665dd0de5e85451dc4bc63bd4baf2035e74 | AkhmadRiswanda/aws-doc-sdk-examples | /go/example_code/lambda/aws-go-sdk-lambda-example-run-function.go | Go | go | 3,342 | permissive |
//snippet-sourcedescription:[<<FILENAME>> demonstrates how to ...]
//snippet-keyword:[Go]
//snippet-keyword:[Code Sample]
//snippet-service:[<<ADD SERVICE>>]
//snippet-sourcetype:[<<snippet or full-example>>]
//snippet-sourcedate:[]
//snippet-sourceauthor:[AWS]
/*
Copyright 2010-2018 Amazon.com, Inc. or... |
fe5f878d56bd2a57b9a3f0fbbd2c8fe342bf0c34 | 9aaabe0b10654fb482355eb3cd23eef61608bb0b | ymaxgit/gvisor | /pkg/tcpip/transport/tcp/connect.go | Go | go | 27,201 | permissive | // Copyright 2016 The Netstack 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 tcp
import (
"sync"
"sync/atomic"
"time"
"gvisor.googlesource.com/gvisor/pkg/rand"
"gvisor.googlesource.com/gvisor/pkg/sleep"
"gvisor.goog... |
39790343c5c9ff30816dd36ca84bb656c8d5f6c7 | 9076113250bae9bceb3202b0362955b65b9717da | bravecheng/moshopserver | /controllers/auth.go | Go | go | 1,910 | permissive | package controllers
import (
"encoding/json"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/harlanc/moshopserver/models"
"github.com/harlanc/moshopserver/services"
"github.com/harlanc/moshopserver/utils"
)
type AuthController struct {
beego.Controller
}
type AuthLoginBody struct {
Cod... |
b0d0eb266a0a4917a1a741d9a6d215b8860cc0f4 | 1ebc7e387589685403983f8478d6d457fcac5e53 | pepov/helm | /cmd/helm/get_all.go | Go | go | 2,296 | permissive | /*
Copyright The Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
ee339f86a4031eac2411f252ed69880c723f6624 | 1e8eeac2e5f20ad4824f13891420a004f1c0abd9 | liyue201/bee | /pkg/topology/topology.go | Go | go | 3,806 | permissive | // Copyright 2020 The Swarm 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 topology exposes abstractions needed in
// topology-aware components.
package topology
import (
"context"
"errors"
"io"
"time"
"github.com/... |
6ee3371a8bc7039e5a844bd75c2506344bc877d7 | 60a8e803f9c15307ef5b7b1d87e4918d34cb68c9 | gamedevboy/tscript | /component.go | Go | go | 296 | permissive | package script
type Component interface {
GetOwner() interface{}
}
type ComponentType struct {
owner interface{}
}
func (o *ComponentType) GetOwner() interface{} {
return o.owner
}
func MakeComponentType(owner interface{}) ComponentType {
return ComponentType{owner: owner}
}
|
da4d5a32614a2cbef596d8d522b336053fdf2e18 | 86b4defe1111344a6b426d8c6222c77e06ca7e9d | dulek/cluster-image-registry-operator | /vendor/github.com/openshift/installer/pkg/asset/machines/machineconfig/trustbundle.go | Go | go | 1,181 | permissive | package machineconfig
import (
"fmt"
ignv2_2types "github.com/coreos/ignition/config/v2_2/types"
"github.com/openshift/installer/pkg/asset/ignition"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ForAdditiona... |
e16a21eaf7595e9e2794f68917b4c3c57d931bc0 | 6e84a267f965a7ad700b0155f79dfb515c26d119 | 0401-7r011/cli | /command/v7/terminate_task_command_test.go | Go | go | 8,973 | permissive | package v7_test
import (
"errors"
"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v3action"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
"code.cloudfoundry.org/cli/command/commandfakes"
"code.cloudfoundry.org/cli/command/translatableerror"
. "code.cloudfoundry.org/cli/... |
b886926d23d65e578e9822d177488671818e35ea | abfbb36672587ae9d9ee825e8bc5fbc9e2e11096 | CIDgravity/Slackbot | /backend/slack/slashCommands.go | Go | go | 1,010 | no_license | package slack
import (
"fmt"
"net/http"
"twinQuasarAppV2/backend/customTypes"
"github.com/filecoin-project/lotus/api/v1api"
"github.com/slack-go/slack"
)
func handleSlash(w http.ResponseWriter, r *http.Request, slackApi *slack.Client, config customTypes.Config, filecoinApi v1api.FullNodeStruct) {
err := verif... |
b6fbcff419c8e6eddc4bdb81c2bb5804767960f9 | 70ceebdd6fee96e5203fedb5ddcb8638720fafa3 | Guillerbr/chainlink | /core/web/transactions_controller_test.go | Go | go | 4,182 | permissive | package web_test
import (
"math/big"
"net/http"
"testing"
"chainlink/core/internal/cltest"
"chainlink/core/store/models"
"chainlink/core/store/presenters"
"chainlink/core/web"
"github.com/manyminds/api2go/jsonapi"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestTransa... |
e3b2330b41550c1ce7ac744d12ae9f9c1ea88737 | e6efbf5697e265bea8cc5f9fdc25c6534d2e900d | konojunya/Go-AST-sample | /main.go | Go | go | 906 | permissive | package main
import (
"go/ast"
"go/format"
"go/token"
"os"
"strconv"
)
func main() {
f := &ast.File{
Name: ast.NewIdent("main"),
Decls: []ast.Decl{
&ast.GenDecl{
Tok: token.IMPORT,
Specs: []ast.Spec{
&ast.ImportSpec{
Path: &ast.BasicLit{
Kind: token.STRING,
Value: strcon... |
5af5bfbe7597d90f1b2a0eab556611d3a3934233 | 582114c036c40ce0da0bc8ea2efbef9127c3c4c3 | gvadrian/clickhouse_sinker | /parser/gjson_test.go | Go | go | 1,881 | permissive | package parser
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGjsonInt(t *testing.T) {
parser := NewParser("gjson", nil, "")
metric := parser.Parse(jsonSample)
var expected int64 = 1536813227
result := metric.GetInt("its")
assert.Equal(t, result, expected)
}
func TestGjsonArrayInt(t *tes... |
1d55d7b9ae625003f2d8a334c5259e46c018e5a3 | 9917d90d2cbee74dfd0f1a9290db5e5fada6d239 | ChrisGe4/finance-go | /crypto/client_test.go | Go | go | 448 | permissive | package crypto
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/chrisge4/finance-go"
tests "github.com/chrisge4/finance-go/testing"
)
func TestGetCryptoPair(t *testing.T) {
tests.SetMarket(finance.MarketStateRegular)
q, err := Get(tests.TestCryptoPairSymbol)
assert.Nil(t, err)
assert.No... |
cb55d087666cff73d2a331d9744c6c12b628bc8e | bbe77a68d8d67b3ec6701a2e8dae145506a99db1 | ORG-MARS/kscan | /lib/port/banner.go | Go | go | 9,407 | no_license | package port
import (
"../../app/config"
"../../app/finger"
"../../app/params"
"../iconhash"
"../misc"
"../shttp"
"../urlparse"
"errors"
"fmt"
"github.com/PuerkitoBio/goquery"
"io/ioutil"
"math/rand"
"net"
"net/http"
"os"
"strings"
"time"
)
type portInfo struct {
Url string
Netloc ... |
aa1bbd60a5122a902976f662efac29f3c82b1bb6 | fc5f1acffb52e5b855fc31b3da2d6a81c263c0ea | croeck/acs-engine | /pkg/acsengine/defaults-apiserver_test.go | Go | go | 15,557 | permissive | package acsengine
import (
"testing"
"github.com/Azure/acs-engine/pkg/api"
"github.com/Azure/acs-engine/pkg/helpers"
"github.com/satori/uuid"
)
const defaultTestClusterVer = "1.7.12"
func TestAPIServerConfigEnableDataEncryptionAtRest(t *testing.T) {
// Test EnableDataEncryptionAtRest = true
cs := createContai... |
76ba8d51e669652ec7a0d1a4641be9e309ac6943 | 42ad8e5ee502bd22bd49746c320c5148286903ee | toni-moreno/ipas-home | /pkg/login/ldap.go | Go | go | 10,742 | permissive | package login
import (
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"io/ioutil"
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/toni-moreno/ipas-home/pkg/config"
"gopkg.in/ldap.v3"
)
type ILdapConn interface {
Bind(username, password string) error
Search(*ldap.SearchRequest) (*ldap.SearchResult, erro... |
2db8a7b23fb03bd831a5f95beb60958ff77fe0bd | e0839d6ba89394be2cd50b6467c10ccbaaadfd4e | chenerwo/practice_go | /start/typeC.go | Go | go | 305 | no_license | package main
import (
"fmt"
)
// 将NewInt定义为int类型
type newInt int
type intAlias = int
func main() {
// 将a声明为NewInt类型
var a newInt
// 查看a的类型名
fmt.Printf("a type : %T\n", a)
// 将a2声明为IntAlias类型
var a2 intAlias
fmt.Printf("a2 type : %T\n", a2)
}
|
a9545bbfdd432c55881a1019acc04e48bf536e1d | da4d7d576f04a81f92dcdd78ba4936ac58b55ddf | kosovo0275/soong | /cc/kernel_headers.go | Go | go | 805 | no_license | package cc
import (
"android/soong/android"
)
type kernelHeadersDecorator struct {
*libraryDecorator
}
func (stub *kernelHeadersDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
if ctx.Device() {
f := &stub.libraryDecorator.flagExporter
for _, dir := range ctx.DeviceC... |
67011c4f66f11d5d0b8386c7ed2f4cf679ab4aa1 | 094cd4bff50b1ec7da01033ad1df6878bbba800f | mafeave/Polux_API | /controllers/formato.go | Go | go | 4,359 | no_license | package controllers
import (
"github.com/mafeave/Polux_API/models"
"encoding/json"
"errors"
"strconv"
"strings"
"github.com/astaxie/beego"
)
// oprations for Formato
type FormatoController struct {
beego.Controller
}
func (c *FormatoController) URLMapping() {
c.Mapping("Post", c.Post)
c.Mapping("GetOne", c... |
9ae6f46d92163b142ac66aedb29005f173b93486 | e75eb30472999d42e0b05992cbf81e4c93fde5f1 | apreiml/prunef | /ctime/strptime.go | Go | go | 3,454 | permissive | // ctime provides time utils that work with posix format specifiers
// like used in strftime(3)
package ctime
import (
"errors"
"fmt"
"strconv"
"strings"
"time"
)
type tm struct {
year, month, day, hour, minute, second int
loc *time.Location
}
type parseState struct {
forma... |
2e7844295c5f255e942d5a2164e1a9ff143b27fb | c0cb9b6c22c0f1b06129f21ebc1ab25e3c2d1d27 | Knappek/mongodbatlas-operator | /vendor/github.com/prometheus/procfs/sysfs/fs.go | Go | go | 1,169 | permissive | // Copyright 2017 The Prometheus 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... |
891baa29a0d34140b8d47173396749bbe776ecba | 443d5b3a70088f9a4cfa8be9d9f89966bd712484 | lavarok/Sia | /modules/renter/contractor/contractor.go | Go | go | 11,871 | permissive | package contractor
// TODO: We are in the middle of migrating the contractor to a new concurrency
// model. The contractor should never call out to another package while under a
// lock (except for the proto package). This is because the renter is going to
// start calling contractor methods while holding the renter l... |
4694885a1a4d1141872fa2f975b2f6e53c300e63 | 02de07262b829ec358e47b4da30bff27f0480c90 | kernt/skipper | /eskip/template_test.go | Go | go | 7,121 | permissive | package eskip
import (
"net/http"
"net/url"
"testing"
"github.com/zalando/skipper/filters/filtertest"
)
type createTestItem struct {
template string
expected string
getter TemplateGetter
}
func testCreate(t *testing.T, items []createTestItem) {
for _, ti := range items {
func() {
template := NewTempl... |
a77a306359376f1cf79faae03fe00d2efef9d146 | 61145f97028bbe5ac82ff1025b21e6ec2ffde2bb | strogo/go-smc | /smc.go | Go | go | 1,275 | permissive | package smc
/*
#cgo LDFLAGS: -framework IOKit
#include <stdlib.h>
#ifndef __SMC_H__
#import "smc.h"
#endif
*/
import "C"
import (
"fmt"
"sync"
"unsafe"
)
// ReadTemperature returns the current temperature in celsius
func ReadTemperature() float64 {
openMutex.Lock()
if !open {
C.SMCOpen()
}
cstr := C.CStri... |
dc20378553b79bdaf3028a74698dd866c881f96f | 9d9a0b7cfbfa29a1cd7ea53f2fdbdf75686d4ce7 | mozillazg/go-unidecode | /table/x08e.go | Go | go | 5,670 | permissive | package table
var x08e = []string{
"Chu ", // 0x00
"Jing ", // 0x01
"Nie ", // 0x02
"Xiao ", // 0x03
"Bo ", // 0x04
"Chi ", // 0x05
"Qun ", // 0x06
"Mou ", // 0x07
"Shu ", // 0x08
"Lang ", // 0x09
"Yong ", // 0x0a
"Jiao ", // 0x0b
"Chou ", // 0x0... |
40b817eba08f340db0eb956be95adab7cdbff46a | 2b8bd9c7022a19d7d48fadc8884e22b738306e50 | talnordan/gloo | /test/local_e2e/cloud_foundry_test.go | Go | go | 9,144 | permissive | package local_e2e
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"net/http"
"os"
"os/exec"
"runtime"
"strconv"
"time"
"code.cloudfoundry.org/copilot"
"code.cloudfoundry.org/copilot/api"
"code.cloudfoundry.org/copilot/config"
"code.cloudfoundry.org/copilot/testhelpers"
"github.com/gogo/protobuf/proto"
... |
d247c5947136b84dff2e6ee082d16dee7e9ccbcb | 1f87725e9a80104c2a1a0bd24077ad346ee2faad | mheon/libpod | /cmd/podman/containers/cleanup.go | Go | go | 3,562 | permissive | package containers
import (
"fmt"
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containe... |
d985b64a649ef1540e6fe2e1f1700a0f593c9ed4 | 5d422954905e914e750568374fbc4c79ae7bb4d1 | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/relay/v20170401/wcfrelayAuthorizationRule.go | Go | go | 6,058 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20170401
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Description of a namespace authorizat... |
3ffcb7a2ce45da99169ac187c17613687c2f06bc | ae0466ac30026baf9d11542ce8e580e0a6196acc | MeRcy-PM/Hello-work | /cmdline.go | Go | go | 2,408 | no_license | package main
import (
"flag"
"fmt"
"net"
"os"
)
type Configuration struct {
IsServer bool
TestTime uint // Uint: Second.
FragmentSize uint
Destination string
Port uint16
}
func (self Configuration) String() string {
var result string
if self.IsServer {
result = fmt.Sprintf("Run as serve... |
a7946786d1089f9a06e2d50908ce038df50cbb9a | 0478790d859d65a90f7626a25db68d389ef7cf52 | drdanialrusdi/core | /server/auth_server.go | Go | go | 3,048 | permissive | package server
import (
"context"
"fmt"
"github.com/onepanelio/core/api"
v1 "github.com/onepanelio/core/pkg"
"github.com/onepanelio/core/pkg/util"
"github.com/onepanelio/core/server/auth"
"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// AuthServer contains logic for... |
07012967f8eeb185e798e664c379c93353d89b6d | be29b65b3f113ecad38dfc147adf20db90f206d7 | scientific-dev/templatify | /use.go | Go | go | 3,966 | permissive | package main
import (
"io/ioutil"
"os"
"os/exec"
"path"
"regexp"
"strconv"
"strings"
"time"
"github.com/gobwas/glob"
)
var (
lockData Config
parseFilesGlob glob.Glob
parserRegex *regexp.Regexp
noGit bool
)
func Use() {
if len(command.Args) == 0 {
command.LogError("No template name ... |
1f0626f0e406dc245eeaa5079b4a7998732ca90b | 8de5110a4151a7e5586a1e9889868e3a23a87eb6 | Amaayezing/ECS-140A | /Go/NFA with Concurrency/nfa_test.go | Go | go | 5,132 | no_license | package nfa
import (
"testing"
)
func dagTransitions(st state, sym rune) []state {
/*
* 0 -a-> 1
* 0 -a-> 2
* 1 -b-> 3
* 2 -c-> 3
*/
return map[state]map[rune][]state{
0: map[rune][]state{
'a': []state{1, 2},
},
1: map[rune][]state{
'b': []state{3},
},
2: map[rune][]state{
'c': []state... |
dccf6da49035460f7be860f03e03faccf3866903 | bf4afd9bd46a5f8d9472e083e15d61f11776a071 | basecamp/sentinel | /config.go | Go | go | 1,901 | permissive | package main
import (
"flag"
"gopkg.in/BlueDragonX/yamlcfg.v1"
"gopkg.in/yaml.v1"
"io/ioutil"
"os"
"strings"
)
const (
DefaultConfigFile = "config.yml"
)
type StringArray []string
func (strs *StringArray) String() string {
return strings.Join(*strs, ",")
}
func (strs *StringArray) Set(value string) error {... |
5d2acb4cb9bbf9c68c2879302369f7f9df19a25f | 4b9f8cde37a6622a674963a6e842de604caefec2 | cossth/grafana | /pkg/services/ngalert/provisioning/templates_test.go | Go | go | 13,692 | permissive | package provisioning
import (
"context"
"fmt"
"testing"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/setting"
mock "github.com/stretchr/testify/mock"... |
0e58c38946733231b1cc1309ac95aa766c67a7f7 | 8f5b2d1148f4fbc11744a4f1f08a960ea881095f | marcustut/personal | /internal/handler/todo.go | Go | go | 1,645 | no_license | package handler
import (
"context"
"encoding/json"
"log"
"net/http"
"strconv"
"github.com/gorilla/mux"
"github.com/marcustut/personal/internal/repo"
)
type TodoHandler struct {
repo *repo.Repo
}
func NewTodoHandler(repo *repo.Repo) *TodoHandler {
return &TodoHandler{
repo: repo,
}
}
func (h *TodoHandle... |
6d065018ebc2c2f69c8f471b20bc060d9e6e85a6 | 8aab657e4453a06952bd0950fef40f3fb360a222 | charygao/godis | /exp/bench/tests.go | Go | go | 1,488 | no_license | package main
import (
"fmt"
"insmo.com/godis/exp"
"net"
"os"
)
func init() {
tests["set"] = setHandle
tests["setpipe"] = setPipelineHandle
tests["get"] = getHandle
tests["rpush"] = rpushHandle
tests["mock"] = mockHandle
}
func rpushHandle(c *redis.Client, ch chan bool) {
for _... |
39bd3b2af9adf3cea22e5b407fc6831557ebc680 | a186f9687162f353eb9321d641705a1553d61d06 | siongui/userpages | /content/code/go/gae/taobao-item2rst/iteminfo.go | Go | go | 1,529 | permissive | package taobaoitem2rst
import (
"golang.org/x/net/html"
"io"
)
type ItemInfo struct {
Title string
URL string
ImgURL string
}
func GetAttribute(n *html.Node, key string) (string, bool) {
for _, attr := range n.Attr {
if attr.Key == key {
return attr.Val, true
}
}
return "", false
}
func isTitleEl... |
7cbcee76213c2b310dc4c057ea7ec6a4ba737ece | cecf6b382ea7810795fefd3c2fc90e30834c7dcc | Yellllllow/douyin-open-api-go | /model_douyin_video_upload_rsp_data.go | Go | go | 531 | no_license | /*
* 抖音开放API
*
* douyin open api
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package douyin
// DouyinVideoUploadRspData struct for DouyinVideoUploadRspData
type DouyinVideoUploadRspData struct {
// 错误码
ErrorCode int64 `json:"error_code,omitempty"`
HasMore b... |
74675ab641185a6a7b5433717208f72d937ce112 | c61fb9d4f9dcf206d308d288591246515446152c | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/patch_gc.go | Go | go | 3,553 | permissive | /**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
5973e9296c60e6e31f5ae6893ffd591e07b9e674 | a165ebf11001d9e50058ad5199923585ff9f368d | sudo-savitaj/goPractice | /BankAccount/main/handler/accountHandler.go | Go | go | 568 | no_license | package handler
import (
"Hackathon/BankAccount/main/service"
"github.com/gin-gonic/gin"
"net/http"
)
type accountHandler struct {
accountService service.AccountService
}
func NewAccountHandler(accountService service.AccountService) *accountHandler{
return &accountHandler{
accountService: accountService,
}
}... |
155532ca9f945087e05a949cffd4e75010954241 | 4a3d62ea25bebad1b5b75f6a42bf1678bfd1bec4 | jlambert68/FenixInception | /go_code/TestExecutionGateway/gatewayObject.go | Go | go | 1,118 | no_license | package TestExecutionGateway
import (
"github.com/jlambert68/FenixInception/go_code/common_code"
"github.com/sirupsen/logrus"
bolt "go.etcd.io/bbolt"
)
var (
// Common logger for the gateway
logger *logrus.Logger
// Database object used for storing any persistent data within Gateway
db *bolt.DB
// Database ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.