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 |
|---|---|---|---|---|---|---|---|---|
f979c21930d0894f0afa00c0b3c18210662ca48c | b09474bc4feacac8937ae107443de355eeb923a0 | AliyunContainerService/alibaba-cloud-metrics-adapter | /vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/configmap_cafile_content.go | Go | go | 8,955 | permissive | /*
Copyright 2019 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, ... |
d8bcf499605c91b804475de470800af6cfb8f647 | 93a60e324653118b41c30a6194ad9c598c1ccaa4 | shunsukeaihara/sphinx-httpserver | /handler.go | Go | go | 1,680 | permissive | package main
import (
"encoding/json"
"errors"
"net/http"
log "github.com/Sirupsen/logrus"
ps "github.com/shunsukeaihara/go-pocketsphinx"
"github.com/unrolled/render"
"golang.org/x/net/context"
"github.com/shunsukeaihara/sphinx-httpserver/sphinx"
"github.com/shunsukeaihara/sphinx-httpserver/utils"
)
var re... |
64c6cda586f45e5325c30e8c483a87586a91d8c2 | b48d08756513b865b4af8eebcc47c53cc16975c9 | xiaopan1991/luban_examples | /Projects/Go_bin/gen/src/cfg/test.MultiRowType2.go | Go | go | 863 | permissive |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//--------------------------------------------... |
0dc5d8c6e1047793f3d0aa2154815685939a5eff | db45ce7ad3870791d9e49be704c2d31efbf5861d | yanqian/Leetcode-Golang | /Easy/L1365.go | Go | go | 437 | no_license | package Easy
func smallerNumbersThanCurrent(nums []int) []int {
occurrences := [101]int{}
for _, num := range nums {
occurrences[num]++
}
prevOccurrences := occurrences[0]
occurrences[0] = 0
for i := range occurrences[1:] {
occurrences[i+1], prevOccurrences = prevOccurrences, prevOccurrences+occurrences[i+1]... |
262b7739ce570a6a71518c20e657a38bc0cf5084 | 46b7fc4be978a2d7c644745d62d417d93bc1b960 | wilso199/cli | /pkg/cmd/release/create/create_test.go | Go | go | 11,701 | permissive | package create
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"testing"
"github.com/cli/cli/internal/ghrepo"
"github.com/cli/cli/pkg/cmd/release/shared"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/httpmock"
"github.com/cli/cli/pkg/iostreams"
"github... |
79d7f35faa0600c9abfe21e1b4b15249f032bc4b | 5a911e83ba0cfa690d44631c407f4363baf0ba73 | ykumar-rb/ZTP | /onboarder/config/config.go | Go | go | 289 | no_license | package config
type ConfigEnvironment struct {
EnvironmentName string `json:"EnvironmentName"`
Mac []string `json:"Mac"`
InstructionFileName string `json:"InstructionFileName"`
AutoUpdate bool `json:"AutoUpdate"`
}
type ClientEnv struct {
ClientConfigFile string
AutoUpdate bool
}
|
3727594c8fcdb789598507f08a78987322d164e4 | 7d578debbf9fb47f8860daa9024c7a2a6905cb5b | ICKelin/gtun | /gtun/session.go | Go | go | 2,365 | permissive | package gtun
import (
"strings"
"sync"
"github.com/ICKelin/gtun/internal/logs"
"github.com/ICKelin/optw/transport"
)
var sessionMgr = &SessionManager{
sessions: make(map[string][]*Session),
}
type SessionMap map[string]*Session
type SessionManager struct {
rwmu sync.RWMutex
sessions map[string][]... |
b7ac4aced62c2623141e5a5d93533f6e4856ce88 | 7586e77ac31ce7e4a8729a7822e340eefa5377e2 | Xu-Bin/kubernetes | /test/e2e/service.go | Go | go | 51,659 | permissive | /*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
85f19c3b494c2e80cb75587fc5a297748ac16410 | 2291ee9f58cbda4fb9ef60e16d449d56857ef3f0 | dtan4/valec | /version/version.go | Go | go | 295 | permissive | package version
import (
"fmt"
)
var (
// Version represents version number
Version string
// Revision represents commit hash at built binary
Revision string
)
// String returns version string
func String() string {
return fmt.Sprintf("Valec version %s, build %s", Version, Revision)
}
|
5ff247e4a1d7ff79af41f4385ece2dc5ee28ed28 | 0ffbe1590cfa08732be019f3cf69601ef8e7f9ce | shaoshing/gotest | /assert.go | Go | go | 4,784 | permissive | package assert
import (
"fmt"
"os"
"reflect"
"regexp"
"runtime/debug"
"strings"
"testing"
)
var Test *testing.T
// assert.Nil(nil) //=> true
// var nilSlice []int
// assert.Nil(nilSlice) //=> true. nil referrence is also nil.
func Nil(actual interface{}) {
NilM(actual, "")
}
// assert.NilM(nil, "nil is nil"... |
ff59419a93958644a8e10e0112ef24835509b3ec | 5d3a5e114bbb890222985baab4a2285b349d5147 | morrell/pulumi-azure-native | /sdk/go/azure/synapse/v20210401preview/sqlPoolVulnerabilityAssessmentRuleBaseline.go | Go | go | 8,497 | 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 v20210401preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A Sql pool vulnerability asses... |
ea6715059eeb4d13d47c53c97894a12291fd4af4 | 1b1fc7359a8ce8bf944692aca71793e14585579a | ajunlonglive/gsweat | /core/gsweat_test.go | Go | go | 1,120 | permissive | package core
import (
"runtime"
"sync"
"testing"
"time"
)
const (
n = 1000000 // 100万
m = 1
MiB = 1048576
)
func TestGSweatPool(t *testing.T) {
var wg sync.WaitGroup
wg.Add(n)
for i := 0; i < n; i++{
err := gsweat.PublishNewJob(demoFunction)
if err != nil {t.Logf("PublishNewJob error: %v", err)}
wg.Do... |
877e1fd78e49b23c03522385587e520dc5d00120 | e2027a3d8aee0874d1f9d40830218c7fd4068aa3 | digitalbitbox/bitbox-wallet-app | /vendor/github.com/digitalbitbox/bitbox02-api-go/api/firmware/error.go | Go | go | 2,056 | permissive | // Copyright 2018-2019 Shift Cryptosecurity AG
//
// 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... |
aebef1dfe310c8cb5be71b6e8acc49ac6d79d20f | 92c898a6b1ad472e386255c701512232f37ef71a | t-efu/go-sample | /application/interfaces/utils/http.go | Go | go | 418 | no_license | package utils
import (
"net/http"
)
// RenderInternalServerError - render internal server error
func RenderInternalServerError(w http.ResponseWriter, err error) {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("internal server error: " + err.Error()))
return
}
// RenderBadRequest - render bad reque... |
bf961d91ac09047d484157794b79fb1780fc489d | 7af765cf98cd0dd709d9f8f92529cd36f6edf00a | zexi/onecloud | /pkg/compute/models/elasticips.go | Go | go | 51,465 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
ed83747bac7332f17eec041e4ff002ef31b5f5f1 | 81ead033c07fc02e5580ff1cf973c5a2cd8b7fdf | dongweiming/LeetCode-in-Go | /Algorithms/0001.two-sum/two-sum.go | Go | go | 243 | permissive | package problem0001
func twoSum(nums []int, target int) []int {
m := make(map[int]int)
for i := 0; i < len(nums); i++ {
n := nums[i]
other := target - n
if a, ok := m[other]; ok {
return []int{a, i}
}
m[n] = i
}
return nil
}
|
7d4c5672002ddb519b3af5270a4730f8ad5ec6c5 | ee93126901d68292d15b8ce061db694a322b4234 | puckel/dgr | /dgr/common/acfullname.go | Go | go | 3,416 | permissive | package common
import (
"encoding/json"
"net/http"
"regexp"
"strings"
"github.com/appc/spec/discovery"
"github.com/juju/errors"
"github.com/n0rad/go-erlog/data"
"github.com/n0rad/go-erlog/errs"
"github.com/n0rad/go-erlog/logs"
)
type ACFullname string
func (n *ACFullname) UnmarshalJSON(data []byte) error {... |
d8db44a0c2c40e36b2ff9a6cd03f74e0d31ab5fd | 6e857d7c4463c466e4a8115f55c9eef104afe854 | douyu/jupiter | /pkg/xlog/config.go | Go | go | 3,473 | permissive | // Copyright 2022 Douyu
//
// 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... |
c3b6e04f21779d3f8d800898739ec50e957de845 | 8a655535a286b11e0e10d23f91d17154c77f4dfc | bediger4000/lru-cache | /lrucache/cache.go | Go | go | 2,271 | no_license | package lru
import "fmt"
func NewCache(n int) *Cache {
// set number of buckets so that the length of hash chains
// is about 10. That's said to be an optimal hash chain length
// and since the hashtable will hold a known number of items (n),
// we can keep the average chain length an "optimal" size.
return &Cac... |
1084606930306b0b04d9e72806496798c5ad1da3 | eabb157d26a0c138b02ef8ab83005f3bf7167be9 | mohitranka/golox | /lox/stmtVisitor.go | Go | go | 431 | no_license | package lox
// StmtVisitor ...
type StmtVisitor interface {
VisitExpressionStmt(stmt *ExpressionStmt) interface{}
VisitPrintStmt(stmt *PrintStmt) interface{}
VisitVarStmt(stmt *VarStmt) interface{}
VisitBlockStmt(stmt *BlockStmt) interface{}
VisitIfStmt(stmt *IfStmt) interface{}
VisitWhileStmt(stmt *WhileStmt) i... |
b03fff2faef490b4f4072355aa59798acea24b5f | e22735c3f402b413d6dd14b29aa44b1a59c67dd7 | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/certificateregistration/v20180201/appServiceCertificateOrder.go | Go | go | 14,226 | 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 v20180201
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// SSL certificate purchase order.
type ... |
8ee97ceb0933e6a59c533d812d8837b0e1263b89 | f0b01e7984c7f2b25df8a3f12e3fdaf55d831bfa | sadiqmmm/gitea | /cmd/restore_repo.go | Go | go | 1,850 | permissive | // Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package cmd
import (
"errors"
"net/http"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/modules/setting"... |
f0f602f5a2fb10d475dc4f0535ba5feae85a26d9 | e64f90e20a82f0cf09068b33130652bc3af54a4b | maopeng0714/onecloud | /pkg/multicloud/aliyun/provider/provider.go | Go | go | 4,661 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
5630a1e9df692064009d68254f78fe7289d9d5eb | 9b30c1b296aef87394efebd644f0f95dfc34df0b | xtaci/evio | /vendor/github.com/kavu/go_reuseport/udp.go | Go | go | 3,949 | permissive | // +build linux darwin dragonfly freebsd netbsd openbsd
// Copyright (C) 2017 Max Riveiro
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation th... |
1432fb52dd16b53d5fe4064594927c26f8fe394c | 004d35fa23b48db3218f8b85ed64456a657aaa15 | rx007/docker | /vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go | Go | go | 2,485 | permissive | // Copyright 2016 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... |
4780d1903f12f2b63d6b5786c4a099cf68b3f8f9 | 6cfbaebb73c05500349d45e7458c64460d036cb0 | vicever/go | /src/cmd/link/internal/ld/go.go | Go | go | 8,251 | permissive | // Copyright 2009 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.
// go-specific code shared across loaders (5l, 6l, 8l).
package ld
import (
"bytes"
"cmd/internal/bio"
"cmd/internal/objabi"
"cmd/link/internal/sym"
"fmt... |
a0e264ca1bd14a44ae4a35816992697d368c603a | 23e0e914fb14beab7ef38d3e9fb37952fb04937c | APIchain/go-micro | /selector/options.go | Go | go | 1,260 | permissive | package selector
import (
"context"
"github.com/bottos-project/go-micro/registry"
)
type Options struct {
Registry registry.Registry
Strategy Strategy
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
type SelectOptions struct {
Filters []Filter
... |
00187b3283da58c5c11acbc56039260385e53d89 | 797e9e7baa308d789f1087376d7d951ba72f9ae8 | hrzq19901209/dvc | /test/client/dockerclient.go | Go | go | 748 | no_license | package main
import (
"fmt"
"github.com/docker/engine-api/client"
"github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/container"
"golang.org/x/net/context"
)
func main() {
defaultHeaders := map[string]string{"User-Agent": "engine-api-cli-1.0"}
cli, err := client.NewClient("unix:///var/run... |
52b7b2cb1fb95a2b0c6d542f6564d311bd485c30 | 11908e03d5381973cb042d87a80182d4f27d3d9d | tenforward/lxd | /lxd/db/storage_volumes.go | Go | go | 33,490 | permissive | //go:build linux && cgo && !agent
// +build linux,cgo,!agent
package db
import (
"database/sql"
"fmt"
"strings"
"time"
"github.com/lxc/lxd/lxd/db/query"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/version"
)
// GetStoragePoolVolumesNames gets the names of all stora... |
49ed6a5bbc9905ceb20dce7b6b0feb7a8ed1867f | bb5ad545b90c397fbc9a9492a072d2c93b7d4c8e | ikingye/karmada | /pkg/webhook/clusterpropagationpolicy/mutating.go | Go | go | 1,995 | permissive | package clusterpropagationpolicy
import (
"context"
"encoding/json"
"fmt"
"net/http"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
"github.com/karmada-io/karmada/pkg/util/helper"
"github.com/karmada-io/karmada/pkg/util/validatio... |
ce1757063571d9e55cd080df768b5ad29dff7616 | 1823694bfd3cf7fdf7ab3311f251ca47218da906 | LiWenGu/go_swagger | /controllers/vo/ReqVo.go | Go | go | 301 | no_license | package vo
type BankcardCheck4metaReqVo struct {
Idnum string `description:"身份证号"`
Phone string `description:"预留手机号"`
Bankcard string `description:"银行卡账号"`
Name string `description:"持卡人姓名"`
}
type TokenReqVo struct {
Securt int `json:"securt"`
}
|
43f933edb131791395d0341451354ba9bf94563f | 8f4e649c1fe869aa266922f3156c29e5c3446c0e | treejames/weixin-5 | /controllers/admin/wechat/ReplayNewsController.go | Go | go | 377 | permissive | //
// Created by weibaohui on 14-9-23.
//
//文件作用:
package wechat
import (
. "weixin/controllers"
)
type ReplayNewsController struct {
BaseController
}
func (c *ReplayNewsController) URLMapping() {
c.Mapping("Index", c.Index)
}
// @router /index [get]
func (this *ReplayNewsController) Index() {
this.TplNames = ... |
6444b1d22d4c91bc473f0c420f307b8b10df3ce4 | e51eead2594ec8ac794563ca655a85864d835ce0 | hyuen/chatserver | /DB.go | Go | go | 675 | no_license | package main
import (
"database/sql"
"os"
_ "github.com/lib/pq"
)
const (
// DbUser = "dbuser"
//DB_PASSWORD = ""
// DbName = "testdb"
DbUser = "root"
DbPassword = "SCUubLc8dhRS2Qt4"
DbName = "db"
)
type DB struct {
connection *sql.DB
}
func (db *DB) connect() {
dbinfo := os.Getenv("DATABASE_UR... |
9e084ebc5bf0665789f31773a749988bf62e5991 | 71e35d421b0d632545438ba9a846d4652c800567 | WuLiFang/csheet | /server/internal/system/app/query/0-queries.go | Go | go | 963 | no_license | package query
import (
"github.com/WuLiFang/csheet/server/v6/internal/client/account"
"github.com/WuLiFang/csheet/server/v6/internal/pubsub"
"github.com/WuLiFang/csheet/server/v6/internal/system/domain/volume"
)
type Queries struct {
canCreateVolumeHandler
openVolumeURLHandler
statVolumeURLHandler
volumeByIDHa... |
299f3318bfe031c2ff0a092de212ef8a278bc008 | 8a205e6c04daafbbb87672f02dde54198f746fe7 | chainopen/MatrixChainCode | /metrics/healthcheck.go | Go | go | 1,683 | permissive | // Copyright (c) 2018 The MATRIX Authors
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php
package metrics
// Healthchecks hold an error value describing an arbitrary up/down status.
type Healthcheck interface {
Check()
Error() e... |
5c0a27bf2c6d96c188c6db1a4b068799c1e16c15 | 5470f4d7ec1a499b290e7e64db3a795a7b40e7f3 | aleshchynskyi/kube-mysql | /controllers/cluster_terminal_builder.go | Go | go | 2,107 | no_license | package controllers
import (
"context"
kubesqlv1alpha1 "github.com/vellanci/kube-mysql.git/api/v1alpha1"
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)
func ... |
42ed031d0272d4c517a9c0a8b5245134f108479c | f9c7969849ba4248181cbf948141f06941cbc031 | queue-b/go-mavlink2 | /slugs/slugs_mobile_location.go | Go | go | 5,553 | permissive | package slugs
/*
Generated using mavgen - https://github.com/ArduPilot/pymavlink/
Copyright 2020 queue-b <https://github.com/queue-b>
Permission is hereby granted, free of charge, to any person obtaining a copy
of the generated software (the "Generated Software"), to deal
in the Generated Software without restrictio... |
3c698b667d561e18e3066c61b05bf7eb0b89147d | 3a7d9d81e18c253fbd561e84f36ac8e419541a2b | kebingzao/go_learn_demo | /L-gotchas-and-common-mistakes/26-Self-increase-and-self-reduction.go | Go | go | 541 | no_license | package main
import "fmt"
/*
自增和自减
许多语言都有自增和自减操作。不像其他语言,Go不支持前置版本的操作。你也无法在表达式中使用这两个操作符。
*/
//失败的例子:
/*func main() {
data := []int{1,2,3}
i := 0
++i //error
fmt.Println(data[i++]) //error
}*/
/*
print::
gotchas-and-common-mistakes\26-Self-increase-and-self-reduction.go:14: syntax error: unexpected ++, expecting }... |
18031496ffc7997519c863a39d7e5e8078a87fa5 | 12f60ca09b1eff98f9dfaaefd0e4bc7160dc1c06 | VostroNet/lego | /vendor/github.com/oracle/oci-go-sdk/dns/create_zone_details.go | Go | go | 2,874 | permissive | // Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Code generated. DO NOT EDIT.
// DNS API
//
// API for the DNS service. Use this API to manage DNS zones, records, and other DNS resources.
// For more information, see Overview of the DNS Service (https://docs.cloud.oracle.com/iaas/Cont... |
61a03b9dc2dbef5b86d6fbfbdfdb1a3215df0b4c | 54c9381dd31767807bc506994765f5ce09bd4c50 | ohatakky/atcoder | /temp20200518_214118/main.go | Go | go | 2,604 | no_license | package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
)
var (
n int
m int
x int
c []int
a [][]int
)
func main() {
n = readi()
m = readi()
x = readi()
c = make([]int, n)
a = make([][]int, n)
for i := 0; i < n; i++ {
c[i] = readi()
a[i] = make([]int, m)
for ii := 0; ii < m; ii++ {
a[i][ii] =... |
1d6e2e59e755f5c4056d3075d74a505096885868 | e00af26338d4f6f175900ac203fa58f0d7cba7dc | Eric-GreenComb/reserve-data | /exchange/bittrex.go | Go | go | 12,630 | permissive | package exchange
import (
"errors"
"fmt"
"log"
"math/big"
"strconv"
"strings"
"sync"
"time"
"github.com/KyberNetwork/reserve-data/common"
ethereum "github.com/ethereum/go-ethereum/common"
)
const BITTREX_EPSILON float64 = 0.000001
type Bittrex struct {
interf BittrexInterface
pairs []common... |
afa73e53c97702c2a63aa4f8c5934714bb7c46d0 | ab78326b708a929aeead5eebec6825e809ee5a23 | shubhamk-cognologix/go-learning | /src/interface/list.go | Go | go | 475 | no_license | package main
import "fmt"
type printer interface {
print()
}
type list []printer
func (l list) print() {
if len(l) == 0 {
fmt.Println("List is empty")
return
}
for _, it := range l {
it.print()
}
}
func (l list) discount(amount float64) {
if len(l) == 0 {
fmt.Println("List is empty")
return
}
ty... |
1b20c1d7fe73151ca09fe62407cd45c023422025 | d027af915049d0dab4c12dfc0685977c8aa0d62a | joint-song/xorm | /rows.go | Go | go | 3,026 | permissive | // Copyright 2015 The Xorm 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 xorm
import (
"context"
"database/sql"
"fmt"
"reflect"
"github.com/lingochamp/core"
)
// Rows rows wrapper a rows to
type Rows struct {
NoTyp... |
061b97b5690a59fd8e7281f345a764a49f5bdc51 | 56a967928a95745aed40af89c6e77c556c74e8b5 | hallgren/wtf | /http/event.go | Go | go | 2,755 | permissive | package http
import (
"context"
"encoding/json"
"net/http"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
// Websocket metrics.
var (
websocketConnections = promauto.NewGauge(prometheus.Gauge... |
a1b76359dc85479a4cefb3b1c92da0dff7d34cbb | e5036a8ad8250587e69c94fb0f7f8d969fd07b6b | zfg88287508/ftp | /fd/driver.go | Go | go | 4,785 | permissive | package fd
import (
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"gortc.io/ftp"
)
type Driver struct {
RootPath string
ftp.Perm
}
type FileInfo struct {
os.FileInfo
mode os.FileMode
owner string
group string
}
func (f *FileInfo) Mode() os.FileMode {
return f.mode
}
func (f *FileInfo) Owner()... |
f0df58d4e7146e24b8e4ce62d7a11d84a850b1f0 | 5b8b9c08b9752a2c73575940efa9b18344e10922 | kevaundray/Neo-Go-API | /database/leveldb.go | Go | go | 5,486 | no_license | // copied and modified from https://github.com/ethereum/go-ethereum/blob/master/ethdb/database.go
package database
import (
"sync"
"time"
"github.com/ethereum/go-ethereum/log"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/errors"
"github.com/syndtr/goleveldb/leveldb/filter"
"githu... |
5d6443f4f5270251ab8fb00202db8eeab6145a53 | aff8d6612079d848cdf75dbac1fdc194ed320c66 | No-Trust/peerster | /common/peer.go | Go | go | 637 | permissive | // Peer implementation
package common
import (
"fmt"
"net"
)
// A gossiper Peer
type Peer struct {
Address net.UDPAddr
Identifier string
}
// (Deep) Copy of a Peer
func (peer *Peer) Copy() Peer {
naddr := net.UDPAddr{
IP: net.ParseIP(peer.Address.IP.String()),
Port: peer.Address.Port,
Zone: "",
}
n... |
683ecd97dbbc4aae1741bdeb5fe441234efba7b4 | babf49491f3397a500e69910a04967a2648b1b38 | 1988tianyuan/LongestSubSeq | /src/leetcode_China/array/main/78-SubSets.go | Go | go | 1,202 | no_license | package main
import (
"fmt"
"sort"
)
//给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。
//
// 说明:解集不能包含重复的子集。
//
// 示例:
//
// 输入: nums = [1,2,3]
//输出:
//[
// [3],
// [1],
// [2],
// [1,2,3],
// [1,3],
// [2,3],
// [1,2],
// []
//]
// Related Topics 位运算 数组 回溯算法
// 👍 917 👎 0
//leetcode submit region begin(Prohibit ... |
c4f42356ecb80ec9acb34bef9642541e05639f95 | 1d378da7b6d256fa5b82c936c345cf64e82fc1fb | epiclabs-io/genji | /cmd/genji/shell/shell.go | Go | go | 6,187 | permissive | package shell
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/asdine/genji"
"github.com/asdine/genji/document"
"github.com/asdine/genji/engine"
"github.com/asdine/genji/engine/badgerengine"
"github.com/asdine/genji/engine/boltengine"
"github.com/asdine/genji/engine/memoryengi... |
93f2abdc9fc833f87241ee8f750fcffe40a150c1 | 2e40e0c0a62cb63a6048bdc47d08ec9039b58384 | dgageot/buildpacks-1 | /builders/gcp/base/acceptance/python_fn_test.go | Go | go | 2,187 | 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
fd1f431e95d79f42d79f35c31cce66ddf846efbd | e4f148bc906d6f9cb1c4555d08f5533c73a9c05f | rusby1818/pegnet | /polling/kitco.go | Go | go | 5,503 | permissive | package polling
import (
"errors"
"io/ioutil"
"net/http"
"strings"
"github.com/pegnet/pegnet/support"
)
type KitcoData struct {
Silver KitcoRecord
Gold KitcoRecord
Platinum KitcoRecord
Palladium KitcoRecord
Rhodium KitcoRecord
}
type KitcoRecord struct {
Date string
Tm str... |
3620e524c5b7157a4a0686a51981c6d1e70eefdd | f8d5ce8c12a430053d199751bf85d2808f213c82 | 22317a57/dokku | /plugins/common/common.go | Go | go | 18,888 | permissive | package common
import (
"bufio"
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"reflect"
"regexp"
"sort"
"strings"
"unicode"
sh "github.com/codeskyblue/go-sh"
)
type errfunc func() error
// ShellCmd represents a shell command to be run for dokku
type ShellCmd struct {
Env ... |
ce6b4b17414456431b95421baefa70e2668ef2b4 | 068a454b633623758cd360891231f2e4f8332c0b | smolderant/noise | /network/config.go | Go | go | 232 | permissive | package network
import (
"github.com/xtaci/smux"
"time"
)
func muxConfig() *smux.Config {
config := smux.DefaultConfig()
config.KeepAliveTimeout = 10 * time.Second
config.KeepAliveInterval = 2 * time.Second
return config
}
|
4a1415728a931121ff633a74472a4ed7345c3c88 | da707ad9e91927b5fac72d012f6aa9f9d1122a74 | kubernetes-sigs/cloud-provider-huaweicloud | /vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model/model_create_l7_rule_request.go | Go | go | 486 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// Request Object
type CreateL7RuleRequest struct {
// 转发策略ID。
L7policyId string `json:"l7policy_id"`
Body *CreateL7RuleRequestBody `json:"body,omitempty"`
}
func (o CreateL7RuleRequest) String() string {
data, err ... |
4c9c7ef5e123a108eb5f939007f9840d4ae6a414 | aff40321710b6ea20bc6d4f42ce547aa6b1d91f0 | jodhaakbar/gofirebaseauth | /config/firebase.go | Go | go | 686 | no_license | package config
import (
"context"
"path/filepath"
firebase "firebase.google.com/go"
"firebase.google.com/go/auth"
"google.golang.org/api/option"
)
func SetupFirebase() *auth.Client {
serviceAccountKeyFilePath, err := filepath.Abs("./serviceAccountKey.json")
if err != nil {
panic("Unable to load serviceAcco... |
c712ec7e34c3512daf4e100d5f390b1d38bb5057 | fe70b27650f39c35eb517c341670c3aef5ee0936 | shuLhan/go-bindata | /cmd/go-bindata/main.go | Go | go | 6,257 | permissive | // Copyright 2018 The go-bindata Authors. All rights reserved.
// Use of this source code is governed by a CC0 1.0 Universal (CC0 1.0)
// Public Domain Dedication license that can be found in the LICENSE file.
package main
import (
"errors"
"flag"
"log"
"os"
"path/filepath"
"regexp"
"runtime"
"github.com/shu... |
88a5e8466c82da4103a4f5b5f93a3ef882ba083a | 73794336b3a11cbc24d158ff09043cf5e83dfcef | qntfy/kops | /upup/pkg/fi/cloudup/dnstasks/dnszone.go | Go | go | 2,735 | permissive | /*
Copyright 2019 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, ... |
9dac88a88d9c7045be44097cc05b56ade3187dc2 | d923cfc9a6b5797aadd755a63c0a6f61be216d0d | DuncanDoyle/terraform-provider-rhoas | /rhoas/serviceaccounts/datasource_serviceaccounts.go | Go | go | 3,037 | no_license | package serviceaccounts
import (
"context"
kafkamgmtclient "github.com/redhat-developer/app-services-sdk-go/kafkamgmt/apiv1/client"
"io/ioutil"
"log"
"strconv"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"redhat.com/rhoas/rhoas-terra... |
0c2e30f9b9d5496eae06548e0ea595bab96c0393 | a53573970967c8fd1d419d160b82d8a02c3edcec | zooeymoon1989/go_web_program | /src/chapter4/flashMessage.go | Go | go | 933 | no_license | package main
import (
"encoding/base64"
"fmt"
"net/http"
"time"
)
func setMessage(w http.ResponseWriter , r *http.Request) {
msg := []byte("Hello World!")
c := http.Cookie{
Name:"flash",
Value:base64.URLEncoding.EncodeToString(msg),//防止有特殊字符
}
http.SetCookie(w , &c)
}
func showMessage(w http.Respons... |
c6c8d1642c01b5582e7336a580a209458bb07c85 | db31d4f8f526d5949a64f162abba302cc9b61bf2 | kokizzu/UVa | /540/540.go | Go | go | 1,454 | permissive | // UVa 540 - Team Queue
package main
import (
"fmt"
"io"
"os"
)
type node struct {
element int
next *node
}
var (
elementMap map[int]int
head, tail *node
)
func enqueue(element int) {
if head == nil {
head = &node{element, nil}
tail = head
return
}
for curr := head; curr != nil; curr = curr.next... |
55b8474926103cc202e4d43dee834aca8938ad17 | 76a28981268ec5c9c0ee16d56f6ea7fa90ef47ec | EricYT/go-examples | /locker/manager.go | Go | go | 1,510 | no_license | package locker
import "sync"
// locker
type LockManager interface {
LockItems(items ...LockItem) (locker Locker)
}
var _ LockManager = (*LockManagerService)(nil)
type LockManagerService struct {
mutex sync.Mutex
items map[interface{}]Locker
}
func NewLockManagerService() *LockManagerService {
lm := &LockManage... |
7bea7fe7608c14b428f469bb0e97fe652b9ed2e5 | c53735aa6f618508d0460e383af8a9ef50fb68c3 | jcgruenhage/dendrite | /src/github.com/matrix-org/dendrite/cmd/dendrite-client-api-server/main.go | Go | go | 4,281 | permissive | // Copyright 2017 Vector Creations Ltd
//
// 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 agre... |
ff16f9ef13e01938c15f5dc9b4edd6a1205fc523 | 6a2f62e099396bb39f379333274c26deeef48409 | complyue/jdfs | /pkg/jdfc/mnt.go | Go | go | 4,598 | permissive | package jdfc
import (
"io/ioutil"
"net/url"
"os"
"path/filepath"
"strings"
"github.com/complyue/jdfs/pkg/errors"
"github.com/complyue/jdfs/pkg/fuse"
"github.com/golang/glog"
)
// PrepareMountpoint takes an argument for mountpoint, determines the absolute path for the
// mountpoint, validate it for JDFS mount... |
e108c48cbff11c5bf4cf8175e0778c59fb1d583b | f21fd5e500a084550c8bf8993dd3f15dd30e0060 | likhita-809/cosmos-sdk | /x/crisis/types/msgs.go | Go | go | 1,285 | permissive | package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// ensure Msg interface compliance at compile time
var _ sdk.Msg = &MsgVerifyInvariant{}
// NewMsgVerifyInvariant creates a new MsgVerifyInvariant object
//nolint:interfacer
func NewMsgVerifyInvariant(sender sdk.AccAddress, invModeName, invRoute stri... |
5e784df3af3a807f4a3f430e09ca380fc92c51e2 | 0c4d79153ab0765a784d2685ce9ea6646858dd9d | liangchaoboy/qlist | /src/qiniustg/change_type.go | Go | go | 691 | no_license | package qiniustg
import (
"config"
"fmt"
"github.com/qiniu/api.v7/storage"
)
func ChangeFileType(retCh chan string, keys []string, cfg config.Config) {
rets, err := changeFileType(keys, cfg)
if err != nil {
fmt.Printf("Batch Error: %#v", err)
}
for i, ret := range rets {
retCh <- fmt.Sprintf("%d\t%s\t%s"... |
204155be26b2cb29712db8ea10e900cdd13ac7cd | d293b77aff60b6ce60a53a1eeff67cc46dd2a990 | DanielAtella/terraform-provider-thunder | /thunder/resource_thunder_snmp_server_enable_traps_gslb.go | Go | go | 3,343 | permissive | package thunder
//Thunder resource SnmpServerEnableTrapsGslb
import (
"context"
go_thunder "github.com/go_thunder/thunder"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"util"
)
func resourceSnmpServerEnableTrapsGslb() *schema.Resource {
retu... |
d5c7f93228f01f58520f9ee96bd09a1a4791ba82 | 0eb3eca7792d73084647bf3f341176fb8dec3564 | stelligent/mu | /provider/aws/task.go | Go | go | 6,275 | permissive | package aws
import (
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecs"
"github.com/aws/aws-sdk-go/service/ecs/ecsiface"
"github.com/pkg/errors"
"github.com/stelligent/mu/common"
)
type ecsTaskManager struct {
ecsAPI ecsiface.ECSAPI... |
6b35dca1e3d2dc926a6d7bdf127a58c1240463ab | e239f68bab558ea3ca4b3b4db870bf7c3e392ca9 | nghianguyen1tiki/tikihackathon | /internal/crawl/crawler.go | Go | go | 6,531 | no_license | package crawl
import (
"context"
"encoding/json"
"errors"
"github.com/nghiant3223/tikihackathon/internal/config"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"github.com/spf13/cast"
"golang.org/x/sync/errgroup"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"github.com/nghiant3223/tikihackathon/internal/model"
"... |
8879255ce6797c74a2dc78683fb6c3a2c21265ec | c0a6015824bd1e650f3f20ab8c8f318a52dfb530 | limitmhw/HydroCMS | /models/Task.go | Go | go | 4,711 | permissive | package models
import (
"fmt"
"strconv"
"time"
// "github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
)
var DefaultTaskList *TaskManager
type Task struct {
Id int64
ID int64 // Unique identifier
Title string // Description
Done bool // Is this task done?
Content string `or... |
813e1d18de4e051dbe330b3ed200dcbd75917e5b | 810c9ebf45739b0cf5e92db9ce8705e0f65de477 | shuoranliu/chubaofs | /sdk/data/wrapper/data_partition.go | Go | go | 4,165 | permissive | // Copyright 2018 The Chubao 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... |
a34e342b67cca315feeb40fff8affbe478a989b3 | dc428340c62c4703c5f3ab31bfd6612e67c2c03f | aruaru0/golang_myatcoder | /yukicoder/1000-1999/1003/main.go | Go | go | 1,183 | no_license | package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
func out(x ...interface{}) {
fmt.Println(x...)
}
var sc = bufio.NewScanner(os.Stdin)
func getInt() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return i
}
func getInts(N int) []int {
ret ... |
f5db46c33ddced29e24138d1a6e9b5e9f025ec28 | 8e90e802717df374c11e75bc8a20ebf54b63a0ff | Dr-Davide/startups_evaluation_innmind_bct4mas | /chaincode/innMind/vendor/github.com/pavva91/invokeapi/agentInvokeCall.go | Go | go | 8,125 | no_license | /*
Created by Valerio Mattioli @ HES-SO (valeriomattioli580@gmail.com
*/
package invokeapi
// WHEN CHANGE THAT NAME REFACTOR DOESN'T WORK NOW THAT IS A PACKAGE, YOU MODIFY HERE, SAVE AND FROM CLI
// DO: govendor update +vendor
// POI VAI A MODIFICARE LE VARIE CHIAMATE DEL PACKAGE INTERESSATE DAL CAMBIAMENTO
import (
... |
790ce9a2737f3e8452c05c04ac0ae940a837215e | 32d4900785af504333d12ae35eca48ec0dbd008b | cosmos-cg-key-management/cosmos-sdk | /x/gov/types/codec.go | Go | go | 1,060 | permissive | package types
import (
"github.com/cosmos/cosmos-sdk/codec"
)
// module codec
var ModuleCdc = codec.New()
// RegisterCodec registers all the necessary types and interfaces for
// governance.
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*Content)(nil), nil)
cdc.RegisterConcrete(MsgSubmitProposal{... |
c2ae6adc753660c4debb39e9a1c681731f2b1e4b | ec7a5fb23dfe273fc96c5ee6b7dfc2ae03cb6fba | isgasho/basicauth | /basicauth.go | Go | go | 18,205 | permissive | package basicauth
import (
"context"
"log"
"net/http"
"net/url"
"strconv"
"strings"
"sync"
"time"
)
const (
// DefaultRealm is the default realm directive value on Default and Load functions.
DefaultRealm = "Authorization Required"
// DefaultMaxTriesCookie is the default cookie name to store the
// curren... |
f4e738956479cd5727c6c17d2e9fa8a46d8c5f6f | 09d2b55a6288a77f4194d53c9b2c51fe736b30aa | tatsuru/mackerel-agent-plugins | /mackerel-plugin-apache2/apache2.go | Go | go | 5,965 | permissive | package main
import (
"os"
"fmt"
"net/http"
"io/ioutil"
"strconv"
"strings"
"errors"
"regexp"
"github.com/codegangsta/cli"
mp "github.com/mackerelio/go-mackerel-plugin"
)
// metric value structure
var graphdef map[string](mp.Graphs) = map[string](mp.Graphs){
"apache2.worke... |
94ff4516faf9859ba4c40d2a8ddd91572802c2f0 | dddc595a24512c6169e792d1351d8e810302eff9 | moule3053/stork | /vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go | Go | go | 20,816 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
c0df566800fa84b8444a202f34c96c90e65ce492 | 251397ec84fac8bbd8794f218ee3046b77455c0d | MohdAhmad/flannel | /Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go | Go | go | 5,605 | permissive | package netlink
import (
"fmt"
"net"
"syscall"
"github.com/coreos/flannel/Godeps/_workspace/src/github.com/vishvananda/netlink/nl"
)
// RtAttr is shared so it is in netlink_linux.go
// RouteAdd will add a route to the system.
// Equivalent to: `ip route add $route`
func RouteAdd(route *Route) error {
req := nl... |
3faa6d6d2d4e04d455aa3c0ebdc09bde237b7b19 | a94d758bb825fba02f13e032c0e747ffe1d4136b | renovate-testing/test-9748-google-cloud-go | /internal/generated/snippets/dialogflow/cx/apiv3beta1/FlowsClient/ImportFlow/main.go | Go | go | 1,344 | permissive | // Copyright 2021 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
623a195420cae7369421b003cfad448fd6df8252 | 1ce4cda22084f29fefb2f70075422940aade4e5b | bootladder/shtodo | /file_io_readtodo_test.go | Go | go | 809 | no_license | package main
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_ReadTodo_NoExternalReadFileDefined_Panics(t *testing.T) {
external.readfile = nil
assert.Panics(t, func() { readTodo("dummy.txt") })
}
func Test_ReadTodo_ErrorOpening_ReturnsError(t *testing.T) {
usingMockReadFileFail(... |
7e6c3adf73ff87eeb96d9bbb7f349e88e4e71ec4 | 2ff6f87289d01a9a7bc03b4b982bbde48e204218 | sanaipey/fullstack-musicstore-app | /album/router.go | Go | go | 928 | no_license | package album
import (
"net/http"
)
var controller = &Controller{Repository: Repository{}}
//Route defines a route
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.Handler
}
//Routes defines the list of routes of our API
type Routes []Route
var routes = Routes{
Rou... |
c399ea2351cabdd70f963a296d37270c4d6bbd31 | a4c05dfa24b363875cfceae27cd1be78749b1745 | SamCracker/golang-blockchain | /main.go | Go | go | 1,793 | no_license | package main
import (
"flag"
"fmt"
"os"
"runtime"
"strconv"
"github.com/SamCracker/golang-blockchain/blockchain"
)
type CommandLine struct {
blockchain *blockchain.BlockChain
}
func (cli *CommandLine) printUsage() {
fmt.Println("Usage:")
fmt.Println(" add -block BLOCK_DATA - add a block to the chain")
fmt... |
a455c09d27aa4298f0cf7fd0fa80b22af15ce9d2 | 54c596f00488f07d313e0d0d42122f69b819d28e | mowazzem/robusta | /internal/app/playground/types.go | Go | go | 387 | permissive | package playground
import "github.com/pthethanh/robusta/internal/pkg/playground"
type (
Request struct {
Code string `json:"code"`
}
Response = playground.RunResponse
EvaluateRequest struct {
ChallengeID string `json:"challenge_id" validate:"required"`
FolderID string `json:"folder_id" validate:"requir... |
81bcb6a602821eabfe27a9165abc080fa43f4908 | 0293843a9d8775591219b41c1df9f6b4090fa884 | paranoidd/teamcity-sdk-go | /teamcity/project_get_test.go | Go | go | 1,033 | permissive | package teamcity
import (
"testing"
"github.com/paranoidd/teamcity-sdk-go/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestClientGetProject(t *testing.T) {
client, err := NewRealTestClient(t)
require.NoError(t, err, "Expected no error")
config, err := client.GetPro... |
e3c93d396aab0025026c3632c09011f9f7b42287 | 36a590be69de4bdb4e01c9a1be43d07f604c5fe4 | JunRun/go-spider | /util/getM3u8.go | Go | go | 716 | no_license | package util
import (
"bufio"
"log"
"os"
"regexp"
"strings"
)
type M3u8 struct {
hardsubLang string `json:"hardsub_lang"`
url string `json:"url"`
}
//正则匹配 寻找.m3u8链接
func GetM3u8(text string) string {
r := regexp.MustCompile(`\{"format":([\w\W]*?)\.m3u8([\w\W]*?)\}`)
machs := r.FindAllString(text, -1... |
6fac263f030b84b334928979caae47836dbf7535 | e2580d3cfb58be4a114e01f347d2e72f17212653 | podhmo/individual-sandbox | /daily/20200728/example_go/00hello/main.go | Go | go | 412 | no_license | package main
import (
"fmt"
"log"
"net/http"
"os"
)
func NewHandler() http.Handler {
mux := http.NewServeMux()
mux.Handle("/hello", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
fmt.Fprint(w, `{"message": "hello world"}`)
}))
return mux
... |
4c559b5eabdca9f2b10c529380adbfd7e4ee6dba | b8362e5a3a9f0bcc3fc64e26d274f6e43527935e | ddspog/goland | /sort/parallel_test.go | Go | go | 442 | no_license | package sort
import (
"runtime"
"testing"
)
func TestParallel(t *testing.T) {
cases := []struct {
in, want []int
}{
{[]int{3, 2, 1}, []int{1, 2, 3}},
{[]int{10, 11, 13, 2, 20, 3, 0, 40, 1, 30, 23, 2, 1}, []int{0, 1, 1, 2, 2, 3, 10, 11, 13, 20, 23, 30, 40}},
}
for _, c := range cases {
got := Parallel(c... |
49f431d222be6c57a05378a7f4ac67e686fecc3e | 805c221a8dd88d5e168f8eeca26ba6c8c895d17b | dylanesque/GoDemos | /makejson.go | Go | go | 446 | no_license | package main
import (
"fmt"
"encoding/json"
"bufio"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
fmt.Println("Enter a name")
name, _ := reader.ReadString('\n')
fmt.Println("Enter an address")
address, _ := reader.ReadString('\n')
addressBook := map[string]string {
"name": name,
"address": ad... |
a83973add11ec36f47e03404815e713dd07536c6 | 0910da66c2665a327831df5e94739738d3ac1477 | TomFraser/DRC2019 | /cmd/speedtest/main.go | Go | go | 435 | permissive | package main
import (
"github.com/alistair-english/DRC2019/pkg/arch"
"github.com/alistair-english/DRC2019/pkg/services/cameraservice"
)
func main() {
router := arch.NewRouter()
spdTstService := &cameraservice.CameraSpeedTestService{}
camService, _ := cameraservice.NewPiCamera()
router.Register(spdTstService)
... |
56af22d8262e89ae68a8b4e2b9266c4fe23a4656 | 45024511121e8ed5cc371c35fce45b22e81ae421 | caticat/FileRenamer | /src/conf/config.go | Go | go | 1,612 | no_license | package conf
import (
"bufio"
"io"
"os"
"strings"
)
const middle = "========="
type Config map[string]string
func LoadConfig(configFile *string) *Config {
cfg := make(Config)
cfg.init(*configFile)
return &cfg
}
func (c *Config) init(path string) {
*c = make(map[string]string)
f, err := os.Open(path)
if ... |
b48a07678e853f128cdec9be7976047abc126c04 | 704f9c5ab87e2ad06375a0b01a75820289634766 | huxulm/cloudmusic | /api/personal_fm.go | Go | go | 371 | permissive | package api
import (
ent "github.com/jackdon/cloudmusic/entities"
"github.com/jackdon/cloudmusic/util"
)
func PersonalFM(cookie *ent.Cookies, query *ent.Query) (*ent.Result, error) {
if res, err := util.DoReq("POST", PERSONAL_FM, DefEmptyOpts().Raw(),
DefOpts().CryptoLinux().Cookie(*cookie).Raw()); err == nil {
... |
594fd5371bd15cf23455f45ffdcd62dbbcb449bb | b388b93c61b10e0f6467ba0f6ee71d75e14b661a | lock19960613/SCL | /Daily/sbgo/ADT.go | Go | go | 225 | no_license | package sbgo
// 二叉树
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
// 链表node
type ListNode struct {
Val int
Next *ListNode
}
type Node struct {
Val int
Next *Node
Random *Node
}
|
b5d1bf4984a3925e5d6343706b239e93b859d441 | 65891dc726c7fe6dce5be74eedead71694954905 | zhijianli88/kops | /cloudmock/aws/mockiam/iamrolepolicy.go | Go | go | 5,246 | permissive | /*
Copyright 2019 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, ... |
d080db02a8ac51d4e21bec719206260e6ef310eb | e48581f22c2f856067f5ac44863fb081b28f2a54 | TruStory/octopus | /services/truapi/db/user.go | Go | go | 22,983 | no_license | package db
import (
"encoding/hex"
"errors"
"fmt"
"log"
"strconv"
"strings"
"time"
"github.com/TruStory/octopus/services/truapi/truapi/regex"
"github.com/go-pg/pg"
"golang.org/x/crypto/bcrypt"
)
// InvitedUserDefaultName is the default name given to the invited user
const InvitedUserDefaultName = "<invited... |
489146c9acaa446bbe1cf53362d53cc606e91d71 | bac41ba7a9b9e86507383f5efe878039fc386555 | wheatandcat/dotstamp_server | /controllers/forget_password/post.go | Go | go | 2,523 | permissive | package controllersForgetPassword
import (
"encoding/json"
"github.com/wheatandcat/dotstamp_server/controllers"
"github.com/wheatandcat/dotstamp_server/models"
"github.com/wheatandcat/dotstamp_server/utils"
"github.com/wheatandcat/dotstamp_server/utils/mail"
"github.com/wheatandcat/dotstamp_server/utils/user"
... |
e2247ac464cf353001f64fdf1e68893321bf01e5 | 75b0b85055ed65904b5216a8b5654408eff2c563 | dongjun111111/projects | /2-Blog-byGolang/feed.go | Go | go | 928 | no_license | package main
import (
"time"
"github.com/gorilla/feeds"
)
var recentPosts []*Post
const feedNum = 10
func addPostToFeed(p *Post) {
for i, rp := range recentPosts {
if p.Time.After(rp.Time) {
recentPosts = append(recentPosts, nil)
copy(recentPosts[i+1:], recentPosts[i:])
recentPosts[i] = p
return
... |
5c296a15d8a4a47cb5d4a12773341257ef67b6bd | bf635d76fa03706e02011420f9e21dd6feae4514 | garyyang85/istio | /pilot/pkg/networking/core/v1alpha3/listener_test.go | Go | go | 89,762 | permissive | // Copyright Istio 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... |
6474fdc9efa910e1af10cf3e5aeb82e2191bde90 | 44bd5e9731e71aa1133175bb55eb721e42071f49 | sallyom/installer | /terraform/providers/aws/vendor/github.com/hashicorp/terraform-provider-aws/internal/service/batch/compute_environment_data_source.go | Go | go | 2,691 | permissive | package batch
import (
"fmt"
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/batch"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
)
func DataS... |
e3ad0c9ec517e667ab14d164f27bd22c56ef8a83 | ad2208be238ae84c0d4cfde51d34cb927367b710 | craftsman-li/beego | /httplib/httplib.go | Go | go | 16,247 | permissive | // Copyright 2014 beego Author. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
6a41eeee5d6e208352a19958349c93c71d658668 | 7c884ef586cb8371f55ca24cf6b593ef391cfebb | mohd7864/helmoperatorsdk | /helmchart-controller/pkg/controller/helmchart/finalizer.go | Go | go | 1,815 | no_license | package helmchart
import (
"context"
ge "errors"
helmv1 "helmchart-controller/pkg/apis/helm/v1"
"github.com/go-logr/logr"
batchv1 "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
)
func (r *ReconcileHelmChart) addFinalizer(reqLogger logr.Logger, m *helmv1.HelmChart) er... |
563cf7418b4bb8dbf1f8be742d85ec25f4998347 | 0304ca72b76953d96a90a7f3d7e6951779a02b8b | RaghavSood/addrconv | /addrconv_test.go | Go | go | 6,321 | no_license | package addrconv
import (
"encoding/hex"
"github.com/RaghavSood/addrconv/address"
"github.com/RaghavSood/blockutils"
"testing"
)
func TestToAddress(t *testing.T) {
var script blockutils.Script
var err error
script, err = hex.DecodeString("76a914bdb2b538e6b07e93d6bafcef4bec9dc936818a1988ac")
if err != nil {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.