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 |
|---|---|---|---|---|---|---|---|---|
efc215d2a938231011cddc739c8c7f72104d67a2 | ac9f02541b1ca42e8d103b143ddfe847f3be6e19 | betty200744/ultimate-go | /leetcode/linked_list/160_getIntersectionNode/160_getIntersectionNode.go | Go | go | 399 | permissive | package _60_getIntersectionNode
type ListNode struct {
Val int
Next *ListNode
}
func NewListNode(value int) *ListNode {
return &ListNode{
Val: value,
Next: nil,
}
}
func GetIntersectionNode(headA, headB *ListNode) *ListNode {
for headA != nil {
tmpB := headB
for tmpB != nil {
if headA == tmpB {
... |
8ce46b9d48c51cb0b6091e056de29076e40b3284 | 47067c3a31d481d1b7b8353337b8dfe9be4e1bff | xiaomaijiang/gopa | /ui/init.go | Go | go | 2,780 | permissive | /*
Copyright 2016 Medcl (m AT medcl.net)
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, so... |
c5eb0fbe57eadf7299652994c4a1ab4661e0851d | d87744ccdb70f02e84f0bdef61025662fbf6097b | ehcoin/EcoSystem-Health-Chain | /vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go | Go | go | 964 | permissive | // Copyright (c) 2018 The Ecosystem Authors
// Distributed under the MIT software license, see the accompanying
// file COPYING or or or http://www.opensource.org/licenses/mit-license.php
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs syscalls.go
package termbox
type syscall_Termios struct {
Iflag uint64... |
bda203dcf48cae2ed54425d06e4dff8b86ab5d68 | eb058d93951d5c4c53742ea6312ec0006677b792 | nickng/dingo-hunter | /examples/squaring-pipeline/main.go | Go | go | 1,337 | permissive | // Command squaring-pipeline comes from Golang blog to demonstrate fan-in and
// explicit cancellation. This is a modified example of the example.
//
// Source: https://blog.golang.org/pipelines
package main
import "fmt"
// The first stage, gen, is a function that converts a list of integers to a
// channel that emit... |
251fea8a21058ae7b793ddbfecee2f620b5c9439 | 692a4a787a5508a62cff33b356b99369a15ae9a3 | TiNiuB/tidb | /util/mock/context.go | Go | go | 6,475 | permissive | // Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
04e28b28890845ec7312c71c568251504bf52e1b | 5e19b27d6a1290fe56fc0ff4a017154c732706b7 | zdyxry/LeetCode | /string/1678_goal_parser_interpretation/1678_goal_parser_interpretation.go | Go | go | 374 | no_license | package main
import "fmt"
func interpret(command string) string {
i := 0
ans := ""
for i < len(command) {
if command[i] == 'G' {
ans += "G"
i += 1
} else {
if command[i+1] == ')' {
ans += "o"
i += 2
} else {
ans += "al"
i += 4
}
}
}
return ans
}
func main() {
command := "G(... |
3b54dcb45f01ab20679d70c8643bac7bd7024464 | 9c1630320cbb57691352587d1fd6f61402fb30a8 | pankaj-lakhina/ciao | /networking/libsnnet/cncivnic_test.go | Go | go | 4,675 | permissive | //
// Copyright (c) 2016 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... |
c067c949ab451c6a1a60fefa2a98f0e68c91cea3 | f8b19e94be5ad09d7e054d4198dcaf3f701c2cda | buildpacks/lifecycle | /platform/experimental_features_test.go | Go | go | 2,015 | permissive | package platform_test
import (
"testing"
"github.com/buildpacks/lifecycle/platform"
"github.com/apex/log"
"github.com/apex/log/handlers/memory"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
llog "github.com/buildpacks/lifecycle/log"
h "github.com/buildpacks/lifecycle/testhelpers"
)
func Test... |
606c8338076e8c7710deac337a71aef88ac96ff7 | f0f03fd194d930bca4c5874248653a212b4d52a0 | iPaladinLLC/caldav-go | /icalendar/values/duration_test.go | Go | go | 1,614 | permissive | package values
import (
"testing"
"time"
"github.com/iPaladinLLC/caldav-go/icalendar"
. "gopkg.in/check.v1"
)
type DurationSuite struct{}
var _ = Suite(new(DurationSuite))
func TestDuration(t *testing.T) { TestingT(t) }
func (s *DurationSuite) TestIsPast(c *C) {
d := NewDuration(-time.Second)
c.Assert(d.IsP... |
77a10617b828007ba84afddd39da40897bf80471 | 967a91350b6e21cd00a8965af6df39f17118739e | moonrhythm/archer | /main.go | Go | go | 711 | permissive | package main
import (
"log"
"net/http"
// inject apis
_ "github.com/moonrhythm/archer/api/environment"
_ "github.com/moonrhythm/archer/api/group"
_ "github.com/moonrhythm/archer/api/list"
_ "github.com/moonrhythm/archer/api/namespace"
_ "github.com/moonrhythm/archer/api/request"
"github.com/moonrhythm/arche... |
ac638e26805048ac6d2fb955f70f2cdfc00d7981 | 1e2032a9b3c733095dfd8e012723713777ec54c8 | njnuwjq/quickfix | /fix50sp2/derivativesecuritylistrequest/DerivativeSecurityListRequest.generated.go | Go | go | 130,602 | permissive | package derivativesecuritylistrequest
import (
"github.com/shopspring/decimal"
"time"
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/enum"
"github.com/quickfixgo/quickfix/field"
"github.com/quickfixgo/quickfix/fixt11"
"github.com/quickfixgo/quickfix/tag"
)
//DerivativeSecurityListRequest is ... |
7d5fb6186487dcfd1d831c48e0eb1883f201d954 | 759ad9e5d5cd50aec6519ac7842d9f58c5ecc212 | harrisonturton/submission-control | /backend/ci/worker.go | Go | go | 4,448 | no_license | package ci
import (
"github.com/harrisonturton/submission-control/backend/store"
"io/ioutil"
"log"
"os"
"os/exec"
"strconv"
)
const (
testDir = "/tmp/submission-app-test/"
testDirPrefix = "testing-submission-"
specFilename = "project.spec.sh"
submissionFilename = "project.zip"
)
// Wo... |
9a8bf7d463a4926fda8b1552871692b128f7dac2 | 787c0cd29dddf143e676aeb36135e597b9c610f3 | mickymiek/go-odoo | /types/res_config_installer.go | Go | go | 1,386 | no_license | package types
import (
"time"
)
type ResConfigInstaller struct {
LastUpdate time.Time `xmlrpc:"__last_update"`
CreateDate time.Time `xmlrpc:"create_date"`
CreateUid Many2One `xmlrpc:"create_uid"`
DisplayName string `xmlrpc:"display_name"`
Id int64 `xmlrpc:"id"`
WriteDate time.Time `xmlrp... |
71c56ba61bd5f51a62c3e7caf42b659952cf2157 | 6e231e12e28b9abd98599b8c13ed8996714f8500 | ankit2001/Golang_Rest_Apis | /router/router.go | Go | go | 218 | permissive | package router
import (
"Golang_Rest_Apis/router/routes"
"github.com/gorilla/mux"
)
//New is function
func New() *mux.Router {
r := mux.NewRouter().StrictSlash(true)
return routes.SetUpRoutesWithMiddlewares(r)
} |
c65ee1846f37b9f068116ca1660523cf9a4db847 | 8c2907c79d78a8c171bbf12fd7207da39061dabe | kahou82/netplugin | /netplugin/netd.go | Go | go | 9,632 | permissive | /***
Copyright 2014 Cisco Systems Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
20a8dac8110b9ce4d904d8d5477aee1922995a29 | 404666b725408e9098980bddf70aeec44d1739a2 | unluna/LeetCode | /马浩钧/BaseComponent/sort/main.go | Go | go | 621 | no_license | package main
import (
"./SortSource"
"fmt"
)
/*
@author katholikos katholik@mail.ccsf.edu
@version 07/05/2020 23:04
@since Go1.13.5
*/
func main() {
arr := []int{1,9,6,3,4,8,7,2,5,0}
fmt.Println("OriginArray:",arr)
//fmt.Println("QuickSort:",SortSource.QuickSort(arr))
//fmt.Println("SelectSort:",Sort... |
1400cc9148f235ef3f567564670637dfdb24afe1 | ed791a5a5d6e62d8d85a0457777d87f897a57c89 | Tej-Singh-Rana/Golang | /old-practice-codes/channel_order.go | Go | go | 672 | no_license | package main
import "fmt"
func main() {
// channels are blocking constructs.
ch := make(chan int)
// case 1
// trying to receive a message from a channel, but haven't generated yet.
// generate the deadlock condition.
fmt.Println(<-ch)
/* we receive a message from a channel but cannot pass the message in abov... |
4c1a9a8ffefc2605746d82b253c8fcc147236b22 | bbfd4afd7c9d0e5554867c11236e7e35f3808365 | ziseputi/upf-2 | /gtp/v1/messages/echo-req_test.go | Go | go | 713 | no_license | // Copyright 2019-2020 upf 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 messages_test
import (
"testing"
"upf/gtp/v1/messages"
"upf/gtp/v1/testutils"
)
func TestEchoRequest(t *testing.T) {
cases := []testutils.TestC... |
bd1911080de670a8415385e54f3b08ae33513e3d | 36e0cc33edc9409aa2950ff43c1a9dfcd3784714 | XnCN/goexamples | /dosya ve dizin islemleri/ders3.go | Go | go | 274 | no_license | package main
//dosyanın adını ve yolunu değiştirmek
import (
"log"
"os"
)
func main(){
originalPath:="dosya ve dizin islemleri/demo.txt"
newPath:="dosya ve dizin islemleri/move/demo.txt"
err := os.Rename(originalPath,newPath)
if err !=nil{
log.Fatal(err)
}
}
|
3ff67b413d8445efe0e643374086d588f099ba1a | 80d34b5f007752b23b605cf1e4a02deed108d921 | rice5/cloud-provider-alibaba-cloud | /cloud-controller-manager/controller/service/controller.go | Go | go | 21,912 | permissive | package service
import (
"fmt"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v12 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wai... |
17b9262ca436ae087e8fbf7526ff09d2e766ed83 | 67c89836410fb2cbd938ca7fa776e6f98b66315a | JamesClonk/cf-eks | /cdk/vendor/github.com/aws/aws-cdk-go/awscdk/cxapi/cxapi.go | Go | go | 45,278 | permissive | package cxapi
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/cloudassemblyschema"
)
// Experimental.
type AssemblyBuildOptions struct {
// Include the specified runtime information (module versions) in manifest.
// Deprec... |
ac31518b824ee1ea36f261e14f20e5c4d366355f | 62104ee088283ba4efdc422b6fd0d0a9ee7b96dd | murosan/shogi-board-server | /app/domain/service/engine.go | Go | go | 6,076 | permissive | package service
import (
"path/filepath"
"github.com/murosan/shogi-board-server/app/domain/config"
"github.com/murosan/shogi-board-server/app/domain/entity/engine"
"github.com/murosan/shogi-board-server/app/domain/entity/shogi"
"github.com/murosan/shogi-board-server/app/domain/entity/usi"
"github.com/murosan/sh... |
a26e125bd735b02d6c9962a9031fdd0b5816b3f7 | 5415705f86a276cd5124eb398a556741f852635c | wangchen0338/chat | /httpserver/chat/ctrl/chat.go | Go | go | 6,556 | no_license | package ctrl
import (
"chat/service"
"encoding/json"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"gopkg.in/fatih/set.v0"
"log"
"net"
"net/http"
"strconv"
"sync"
)
const (
CMD_SINGLE_MSG = 10
CMD_ROOM_MSG = 11
CMD_HEART = 0
)
type Message struct {
Id int64 `json:"id,omitempty"... |
7fa3d80a32333ef60f1ce40332d370727cb17e19 | 99f19ebab31c569bc2171dab593fd4805db7bb51 | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/databoxedge/v20190701/role.go | Go | go | 4,489 | 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 v20190701
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Compute role.
type Role struct {
pul... |
3e638194acf2575ef1afa44d7418d206e5db63bb | cb8ab8615d1ed9f94bc5751447a459098f055b40 | Varaxian/evedata | /services/hammer/contactSync.go | Go | go | 11,170 | permissive | package hammer
import (
"context"
"errors"
"log"
"strconv"
"strings"
"github.com/antihax/goesi/esi"
"github.com/antihax/goesi/optional"
"github.com/antihax/goesi"
"golang.org/x/oauth2"
)
func init() {
registerConsumer("characterContactSync", characterContactSyncConsumer)
}
func characterContactSyncConsum... |
2a5c1d3e7a04637fcf1e68ce6a31877dfb83755b | a9868f3c619909238e1b0b12db96f9471f20672b | jokereven/go-source-code | /github.com/网络编程+单元测试/socket编程/net包实现tcp服务.go | Go | go | 820 | no_license | package main
import "fmt"
/*
Go语言实现TCP通信
TCP协议
TCP/IP(Transmission Control Protocol/Internet Protocol) 即传输控制协议/网间协议,是一种面向连接(连接导向)的、可靠的、基于字节流的传输层(Transport layer)通信协议,因为是面向连接的协议,数据像水流一样传输,会存在黏包问题。
TCP服务端
一个TCP服务端可以同时连接很多个客户端,例如世界各地的用户使用自己电脑上的浏览器访问淘宝网。因为Go语言中创建多个goroutine实现并发非常方便和高效,所以我们可以每建立一次链接就创建一个goroutine去处理。
T... |
0cc2bf77dd313d691ff2ae607e44709b7871d4e4 | 8b04d7f21809746d9cc6fe8d6e59473b75cf6d60 | SophisticaSean/meme_coin | /handlers/db.go | Go | go | 19,546 | no_license | package handlers
import (
_ "database/sql" // necessary for sqlx
"log"
"os"
"strconv"
"strings"
"time"
"fmt"
"github.com/SophisticaSean/meme_coin/interaction"
_ "github.com/bmizerany/pq" // necessary for sqlx
"github.com/bwmarrin/discordgo"
"github.com/jmoiron/sqlx"
)
type Stats struct {
TotalUsers int... |
cd598735b13de1d3ac64059d8623a56b2028b162 | 5c48fb60b5df8b3318c6ae39bbd12405c61edb88 | lnsp/gvisor | /test/runtimes/proctor/lib/go.go | Go | go | 2,827 | permissive | // Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
e6fedb22601ce2b6871f39da491a2b108ca41cbc | 6000e70e61891d6ddc16611a42cc5ba0f9ed104c | zainokta/inventory_go | /internal/modules/stock/usecase/getProductStockByProductID.go | Go | go | 542 | no_license | package usecase
import "muramasa/internal/modules/stock/entity"
type GetProductStockByProductId struct {
stockRepository entity.IStockRepository
}
func NewGetProductStockByProductIdUseCase(stockRepository entity.IStockRepository) *GetProductStockByProductId {
return &GetProductStockByProductId{stockRepository: sto... |
45450782cd446b6e7703d6717c5fe6eba1aab85c | 0103534e7ff9e15c9b2a9d020af0be6a2180a3bb | uyaki/uyaki-learning-go | /1-07-maps/v2/dictionary.go | Go | go | 367 | no_license | package v1
import "errors"
type Dictionary map[string]string
var ErrNotFound = errors.New("could not find the word you were looking for")
func (dict Dictionary) Search(word string) (string, error) {
// 第二个值是一个布尔值,表示是否成功找到 key。
definition, ok := dict[word]
if !ok {
return "", ErrNotFound
}
return definition,... |
c43e759f727d123fdbc8e7998994c76d6d8ec686 | 53d24c875e3ca50d749720419e26a4fa0827999b | cernbox/ocis-canary | /pkg/command/server.go | Go | go | 6,422 | permissive | package command
import (
"context"
"flag"
"os"
"os/signal"
"strings"
"time"
"contrib.go.opencensus.io/exporter/jaeger"
"contrib.go.opencensus.io/exporter/ocagent"
"contrib.go.opencensus.io/exporter/zipkin"
"github.com/cernbox/ocis-canary/pkg/config"
"github.com/cernbox/ocis-canary/pkg/flagset"
"github.com... |
6b13d5801f048c165789990119702c1a92aff431 | f945ad360c3b3fc9c10f57d29257f99f690956cb | devigned/apmz | /cmd/time/diff.go | Go | go | 1,478 | permissive | package time
import (
"context"
"math"
"time"
"github.com/spf13/cobra"
"github.com/devigned/apmz/pkg/service"
"github.com/devigned/apmz/pkg/xcobra"
)
type (
diffArgs struct {
A int64
B int64
Format string
}
)
// newDiffUnixNanoCommand creates a new `apmz time diff` command
func newDiffUnixN... |
7aea0cf3b519ab9f6864306362cc819ed39fda06 | 7d8efa1941f6148a5a630f57d165e33a39ba6b43 | huynhducduy/go-blog-api | /internal/blog/blog.go | Go | go | 651 | no_license | package blog
import "go-blog/internal/user"
type Blog struct {
Id *int64 `json:"id,omitempty"`
Title *string `json:"title"`
Description *string `json:"description"`
Slug *string `json:"slug"`
Image *string `json:"image"`
Content *string `json:"content"`
CreatedAt *int64 `json:"cre... |
c802659b16d8e2ddbe3aebf746f85b6112bcd005 | 1d5554aec071b33a6b65c24cce5f1e6657669692 | 163yun/kompose | /pkg/kobject/kobject.go | Go | go | 4,425 | permissive | /*
Copyright 2016 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... |
86a77f5bd5717da5fb9bc31e57092401def3ec6e | 06690d96293198401efb0bd7ea5010be5699b71b | weilaaa/Vchat | /Vchat/vServer/main/processor.go | Go | go | 2,200 | permissive | package main
import (
"Vchat/common/message"
"Vchat/vServer/process"
"Vchat/vServer/utils"
"fmt"
"io"
"net"
)
type Processor struct {
Conn net.Conn
}
func (this *Processor) Process() {
defer this.Conn.Close()
// read conn on loop
// keep curUserId to record current user
var curUserId *int
a := -1
curUse... |
83fafa12e83d08face8e9d207830d37fbf6ab1c3 | 850f03703660660d08a665d4a188d8d0338bac90 | syronz/sigma-mono | /cmd/testinsertion/insertdata/table/settings.go | Go | go | 6,204 | permissive | package table
import (
"sigmamono/internal/core"
"sigmamono/internal/types"
"sigmamono/model"
"sigmamono/repo"
"sigmamono/service"
)
// InsertSettings for add required settings
func InsertSettings(engine *core.Engine) {
settingRepo := repo.ProvideSettingRepo(engine)
settingService := service.ProvideSettingServ... |
a869ba598aec6ba24483cbddf7d18ac8cf2c71d2 | 6d3e6f390f6be4e5c99dd8e553ebde96b92ae07a | neutronth/go-ipset | /ipsetspec.go | Go | go | 1,366 | no_license | // Copyright 2020 Neutron Soutmun <neutron@neutron.in.th>
//
// SPDX-License-Identifier: Apache-2.0
package ipset
type IPSetSpecFunc func(*IPSet)
// IPSetName set the name.
func IPSetName(name string) IPSetSpecFunc {
return func(set *IPSet) {
set.Name = name
}
}
// IPSetType set the type.
func IPSetType(setType... |
c6ca6e73cfd96dbc875e20348b365cea33b049b5 | c3ff0ca6327fa0a7a63f2a3de1a8831bfe96a085 | ajbosco/rides | /cmd/schedule.go | Go | go | 381 | permissive | package cmd
import (
"os"
"github.com/spf13/cobra"
)
func newScheduleCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "schedule",
Short: "Show your upcoming workout schedule and add/remove to it",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
os.Exit(1)
},
}
cmd.AddCommand(
newS... |
06a43c300b0f5f353728764e1adfbd992e7340db | 5be8e558e9b9a46d4bb0bf9526ac7ce333839555 | negz/coredns | /plugin/kubernetes/kubernetes.go | Go | go | 16,613 | permissive | // Package kubernetes provides the kubernetes backend.
package kubernetes
import (
"errors"
"fmt"
"net"
"strings"
"sync/atomic"
"time"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/etcd/msg"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/fall"... |
bf88d7ae522159ab9f46f0a55fc9390aa33d3c84 | c863c0c2b56a56345cd9400a7d0a9479b3ab71fa | neverso/nerdctl | /pkg/imgutil/pull/pull.go | Go | go | 2,576 | permissive | /*
Copyright The nerdctl Authors.
Copyright The containerd 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 requi... |
2f78b335c3dacaed37e6d46a9c633e4ec3127c85 | ba26c5f0f7689850717a7146a4874a46818205db | sudeepgoyal75/terraform-provider-nuagenetworks | /4.0.11.2/nuagenetworks/resource_nuagenetworks_applicationperformancemanagement.go | Go | go | 4,499 | no_license | package nuagenetworks
import (
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/4.0.11.2"
)
func resourceApplicationperformancemanagement() *schema.Resource {
return &schema.Resource{
Create: resourceApplicationperformancemanagementCreate,
Read: resourc... |
0731b85139eb29e8f4c3dc1dbd8f8ca69c182178 | 1679783898f39d2b307ef0de62ee874ef93431a0 | vitalyisaev2/buildgraph | /graph/graph.go | Go | go | 3,429 | no_license | package graph
import (
"bytes"
"fmt"
"sort"
)
type defaultGraph struct {
storage map[string]Node
}
func (g *defaultGraph) GetNode(nodeName string) (Node, error) {
if n, ok := g.storage[nodeName]; ok {
return n, nil
}
return nil, fmt.Errorf("Node %s does not exist", nodeName)
}
func (g *defaultGraph) Creat... |
3787fc9f7ea5801080ef714b21b717f8f15c8ee5 | 2e7399744daf419f30997116455ed65fae80d13c | MichaelMure/camlistore | /pkg/blobserver/encrypt/encrypt.go | Go | go | 13,998 | permissive | /*
Copyright 2013 Google 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
di... |
257c1b85634f7944337d79042e0cf57215c307ed | 41f57ed12f73ec9bf534a0a161f4f1e6fb0151d4 | ahxhyjjg/ITflow | /go/bug/bugconfig/mail.go | Go | go | 473 | permissive | package bugconfig
import (
"database/sql"
"fmt"
"itflow/gadb"
"log"
)
func cacheemail(db *gadb.Db) {
err := db.GetOne("select id,email,password,port,createuser,createbug,passbug from email").Scan(&CacheEmail.Id, &CacheEmail.EmailAddr, &CacheEmail.Password, &CacheEmail.Port, &CacheEmail.CreateUser, &CacheEmail.Cr... |
f4e68d311ec555a5fbe38d974d06ea83d99f3163 | 2ae9cd54589b1fe80e2f7e7b715cd200e1d15ba5 | jotitan/music_server | /src/arguments/arguments.go | Go | go | 1,649 | permissive | package arguments
import (
"os"
"strconv"
"strings"
)
type Arguments struct {
data map[string]string
}
func NewArguments() Arguments {
args := Arguments{make(map[string]string)}
args.parse()
return args
}
func (args Arguments) Check(names []string) bool {
for _, name := range names {
if _, ok := args.data... |
989e60cf556c2f68f78fbfb748f7eb8a8f97279e | 41a1d0beff97cd2859faefcc2712855bd2ae71a0 | ZakAnderson/k8gb | /api/v1beta1/gslb_types.go | Go | go | 2,503 | permissive | /*
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
distributed under the License... |
e2f721374459713ff7c1f57fa225f3fdcdee5cba | 92afa9df8cee8d6ad8cc8557d71a80088599b636 | Jiangyouhua/golang | /log/logout.go | Go | go | 1,465 | no_license | package logout
import (
"fmt"
"log"
"os"
"runtime"
"time"
)
type Logout struct {
Path string
File string
Class int //按哪种时间类型输出:年、月、日天
current string
logger *log.Logger
logfile *os.File
}
//写入前初始工作
func (e *Logout) Start() {
//创建目录
err := os.MkdirAll(e.Path, os.ModePerm)
... |
4b99b9f129f39048df9fa4ae9f5f98a55384b154 | 559b6dcb3e7776c1fa19201f4a00a857b2aff77f | yizhiren/6.824 | /src/shardmaster/test_test.go | Go | go | 8,557 | no_license | package shardmaster
import (
"sync"
"testing"
)
// import "time"
import "fmt"
func check(t *testing.T, groups []int, ck *Clerk) {
//fmt.Printf("[check] groups:%+v\n", groups)
c := ck.Query(-1)
if len(c.Groups) != len(groups) {
fmt.Printf("log.wanted %v groups, got %v\n", groups, c.Groups)
t.Fatalf("wanted %... |
6a78b1448ebabf49ec0af369c4f5a415e36ad9e7 | 73d4cafbf33cef379994a74dd90e74d016ab6895 | fd0/erpel | /internal/erpel/state_test.go | Go | go | 3,234 | permissive | package erpel
import (
"bytes"
"io/ioutil"
"os"
"strings"
"testing"
)
func tempfile(t *testing.T) string {
f, err := ioutil.TempFile("", "erpel-test-")
if err != nil {
t.Fatalf("TempFile(): %v", err)
}
name := f.Name()
if err = f.Close(); err != nil {
t.Fatalf("Close(): %v", err)
}
return name
}
f... |
d3b57eb3a2594d86551fa8d6473fb46918b7c202 | 9ba5dbc836d1fe77ed161a07db6e84d894b18729 | qiu-peng20/gorm | /session/transaction.go | Go | go | 477 | no_license | package session
import "gorm/log"
func (s *Session) Begin() (err error) {
log.Info("Transaction Begin")
if s.tx, err = s.db.Begin(); err != nil {
log.Error(err)
}
return
}
func (s *Session) Commit() (err error) {
log.Info("Transaction Commit")
if err = s.tx.Commit(); err != nil {
log.Error(err)
}
retu... |
2c4bf6eadaedeb9f2082c6d43887a6df7ef0e821 | 3ab62c3afd11f024a0139f67675a0922da85d036 | lijianwei123/go-test | /toolkit/batch_jobs/web/tests/default_test.go | Go | go | 934 | no_license | package test
import (
_ "github.com/lijianwei123/go-test/toolkit/batch_jobs/web/routers"
"net/http"
"net/http/httptest"
"path/filepath"
"runtime"
"testing"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(1)
apppath, _ := filepath.Abs(f... |
f5df0bcacb98a8e0c36e3a5a4387ee36e2fe71ff | b130cb66d51dd3c56add38ecc6d4dbdf916a4bb5 | melvinodsa/fileUpload | /modules/qr/qr.go | Go | go | 2,623 | permissive | // Copyright 2011 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 qr encodes QR codes.
*/
package qr
import (
"errors"
"image"
"image/color"
"github.com/melvinodsa/fileUpload/modules/qr/coding"
)
// A Level ... |
6b443b3bccada701ae11ed9fbc1a6eb744f72d77 | bbfeb6ab576c914d5988225358dd78e4857659ed | jeffdinotoriverbed/abc | /vendor/github.com/google/martian/martianlog/logger_test.go | Go | go | 3,559 | permissive | // Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
8eec08a89c2c38d518abdf573742b022e8a089b9 | 101bac579a1ea6df43381ae0fc2a837be4c14bd8 | qeedquan/misc_utilities | /linux/diskdump.go | Go | go | 3,007 | permissive | package main
import (
"bytes"
"flag"
"fmt"
"io"
"os"
)
var (
status = 0
)
func main() {
flag.Usage = usage
flag.Parse()
if flag.NArg() < 1 {
usage()
}
for _, name := range flag.Args() {
ek(dump(name))
}
os.Exit(status)
}
func usage() {
fmt.Fprintln(os.Stderr, "usage: dis... |
d8fc52e992a0f4c56f389e4083f8b8754add66ca | 95390917bd29564c1325430a583c9c72ad646691 | forging2012/go-json-spec-handler | /client/delete_test.go | Go | go | 462 | permissive | package jsc
import (
"net/http"
"net/http/httptest"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestDelete(t *testing.T) {
Convey("DELETE Tests", t, func() {
api := testAPI()
server := httptest.NewServer(api)
defer server.Close()
baseURL := server.URL
Convey("->Delete()", func() ... |
44c35c69ecf0db14241b99e8827ced67b449397a | ca955332af6cf411b975ca156a398d7761a820b8 | unmeshdesale/kubevirt | /pkg/api/v1/types.go | Go | go | 24,869 | permissive | /*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
3df53cf9e4bbf0d9c7774afdeeaa913e23e89560 | 9b5eb4408ba06eeefbf2b08495d6f1a6dabe5df2 | Hvoya/clinic-api | /swagger/init.go | Go | go | 398 | no_license | package swagger
import (
"clinic/docs"
"github.com/go-chi/chi"
httpSwagger "github.com/swaggo/http-swagger"
)
func InitSwagger(router *chi.Mux) {
docs.SwaggerInfo.Title = "Clinic Api"
docs.SwaggerInfo.Description = "Simple api for clinic app"
docs.SwaggerInfo.Version = "1.0"
router.Get("/swagger/*", httpSwagge... |
4d548a1775a9a19e2ca5737dcee544b0e52bb72d | 1d2f8cd5bf9136dd96ddfc38f353be5becae21a1 | TenderPro/nrpc | /nrpc.go | Go | go | 21,620 | permissive | package nrpc
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"log"
"runtime/debug"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go"
jsonpb "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
// ContextKey type for storing values into context.Context
type Co... |
a3ddcfe201472b89e3a1b584bca1df6f78740d7e | 7631ce3797f2bcd4265980427f5d800bb1f427d8 | RainbowMango/GoExpertProgrammingSourceCode | /generics/examples/sort.go | Go | go | 844 | no_license | package examples
import "sort"
// Ordered 定义适用于所有可排序类型的类型集合
// 可排序类型是指支持 <、<=、>=、>操作的类型
type Ordered interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
~float32 | ~float64 |
~string
}
// orderedSlice 实现了sort.Interface,所以可以使用sort.Sort排序
type orderedS... |
18b8379165ea70614e0e12523e0ebaa593d36cf1 | 0d1abf7666942b4729647d8363629a5902b85408 | tshackstream/work-counter-backend | /resources/db.go | Go | go | 491 | no_license | package resources
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
"os"
)
func DbConnect() (*gorm.DB, error) {
DBMS := "mysql"
USER := os.Getenv("MYSQL_USER")
PASS := os.Getenv("MYSQL_PASSWORD")
PROTOCOL := "tcp(" + os.Getenv("MYSQL_HOST") + ":" + os.Getenv("MYSQL_PORT") + ")"
DBNAME := "w... |
a47bb1bc3394d084de2424af29ce7f5acc52aa69 | b688b0a969a1eb05103f207f636285b54fd563dc | Telestream/telestream-cloud-go-sdk | /qc/model_hdr_test_.go | Go | go | 931 | permissive | /*
* Qc API
*
* Qc API
*
* API version: 3.0.0
* Contact: cloudsupport@telestream.net
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package qc
type HdrTest struct {
HdrStandard HdrStandardType `json:"hdr_standard,omitempty"`
MaxFallMaxEnabled bool `json:"max_fall_max_enabled,omitempty... |
760e493ef359030d75362bcfeae686befa67ea90 | 6316a813e4979ac03b79581fa001a053dd61bcd2 | tflovorn/scExplorer | /tempFluc/specificHeat.go | Go | go | 4,260 | permissive | package tempFluc
import (
"fmt"
"math"
)
import (
"github.com/tflovorn/scExplorer/integrate"
"github.com/tflovorn/scExplorer/solve"
"github.com/tflovorn/scExplorer/tempAll"
"github.com/tflovorn/scExplorer/tempCrit"
)
type SpecificHeatEnv struct {
tempAll.Environment
X2, SH_1, SH_2 float64
}
// Get T for a Sp... |
a5eb81f0287005e3e96574c26c59934f2ca55ccd | 47b2193b5cc7c54f10e9fe3880c2c37bed558336 | lmlg/fuchsia | /tools/fidl/fidlgen_go/codegen/ir.go | Go | go | 31,597 | permissive | // Copyright 2018 The Fuchsia 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 codegen
import (
"fmt"
"math"
"sort"
"strconv"
"strings"
"go.fuchsia.dev/fuchsia/tools/fidl/lib/fidlgen"
)
const (
ProxySuffix ... |
ec8adaeac48a158737e91cf06a9c09e7edc209d7 | f48b2ade69ac1e275342589073f51aa0238c6d35 | pi-pi-miao/drycc | /test/test_cli.go | Go | go | 52,359 | permissive | package main
import (
"bufio"
"bytes"
"crypto/sha512"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
units "github.com/docker/go-units"
"github.com/drycc/drycc/cli/config"
"github.com/drycc/dr... |
18570ed56a8b373e3c929ca0f93e65a848c7c712 | c74f27a1b7d1f852121f39c7b955d477b87421b4 | sky-bai/blog-service | /pkg/email/email.go | Go | go | 990 | no_license | package email
import (
"crypto/tls"
"gopkg.in/gomail.v2"
)
type Email struct {
*SMTPInfo
}
//smtpinfo协议服务器所包含的设置
type SMTPInfo struct {
Host string
Port int
IsSSL bool
UserName string
Password string
From string
}
//传入sm为email赋值
func NewEmail(info *SMTPInfo) *Email {
return &Email{info}
}
... |
421ff2402cc0bbb38e6d6f4f2c9ecac3742456bc | 257619951d4a76439988025607b40df32ad2090a | pengmingde/vitess | /go/vt/vtgate/vtgateconntest/client.go | Go | go | 64,033 | permissive | // Copyright 2015, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package vtgateconntest provides the test methods to make sure a
// vtgateconn/vtgateservice pair over RPC works correctly.
package vtgateconntest
import (
"er... |
8dddccdd624f5b8a5cb83194f4afe905ad8d6610 | e9568284358af3a2b0645dd06fc8a2d5d640aa01 | csubbum/Challenge | /rest.go | Go | go | 1,706 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
func upload(w http.ResponseWriter, r *http.Request) {
log.Println("Entered file upload.")
file, handler, err := r.FormFile("myFile")
if err != nil {
log.Println("Error uploading the File")
w.WriteHeader(400)
fmt.Fprintf(w, "Erro... |
4449af1fd0b889f5b73b068e4ecf3211a298d569 | a103f899e380814e6524e026b4f613f06a6aa16c | hwj128911/goshopping | /server/models/user.go | Go | go | 2,284 | no_license | package models
import (
"strconv"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/thewinds/goshopping/server/com"
)
type User struct {
Id int64
Username string
Password string
Phone string
Iconpath string
Email string
Bonuspoints int
}
//AddUser 根据用户结构添加用户
func AddUser... |
ca92e522a33c39eeddc5095962d3c3fb85212b2e | 7f4f87e1f85ab301b29cfbfcbbf5703c3d86446e | pottava/ngc-registry-api | /app/ngc/registry/auth.go | Go | go | 2,008 | no_license | package registry
import (
"fmt"
"net/http"
"strings"
"time"
"github.com/dgrijalva/jwt-go"
)
// Claims used at NGC authentication
type Claims struct {
Subject string `json:"sub,omitempty"`
Issuer string `json:"iss,omitempty"`
ClientID string `json:"authClientId,omitempty"`
NotBefore int64 `json:"nbf,o... |
cb53859ed28bd49c592d4f011dfa002c58806627 | 3bc1c8aee5c0162d09bdc8f4f52a61866b31da39 | manojkva/go-redfish | /client/model_state.go | Go | go | 702 | permissive | /*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package client
// State the model 'State'
type State string
// List of State
const (
STATE_ENABLED State = "Enabled"
STATE_D... |
6d9713a07c7c6712e8b521aab64c013fee7b3ce5 | eabc91645a3791967132e194ab4db799a0ae67e7 | huxiangzheng/iotex-core | /state/factory/workingset_test.go | Go | go | 6,778 | permissive | // Copyright (c) 2020 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use... |
430d2c84f769f32566a24dbb5eec18dd35a3f9c5 | f3f4fe958d4187d6104d2bdcace260c5ec31d07f | k0nAn-1123/alfred-1 | /app/api/auth.go | Go | go | 759 | no_license | package api
import (
"alfred/app/model"
"alfred/app/service"
"alfred/library/response"
"github.com/gogf/gf/net/ghttp"
)
var Auth = authApi{}
type authApi struct {}
func (a *authApi) Login(r *ghttp.Request) {
var (
req *model.AuthReq
)
if err := r.Parse(&req); err != nil {
response.JsonExit(r, 500, err.Er... |
d8a54b98569fa291bc7371fb1a6f2abf38aa0883 | e6e1564b0a07b4415abb94d24e5728cdf7a29c41 | fasthttp/http2 | /examples/simple/main.go | Go | go | 878 | permissive | package main
import (
"fmt"
"log"
"time"
"github.com/dgrr/http2"
"github.com/valyala/fasthttp"
)
func main() {
cert, priv, err := GenerateTestCertificate("localhost:8443")
if err != nil {
log.Fatalln(err)
}
s := &fasthttp.Server{
ReadTimeout: time.Second * 3,
Handler: requestHandler,
Name: ... |
a219a3ee615a8d88518fddc47734c66657ed4bcd | e4d47f3af9b5110385243d8dbb0e8114775181a3 | austinabell/specs-actors | /actors/builtin/miner/policy.go | Go | go | 2,651 | permissive | package miner
import (
abi "github.com/filecoin-project/specs-actors/actors/abi"
big "github.com/filecoin-project/specs-actors/actors/abi/big"
power "github.com/filecoin-project/specs-actors/actors/builtin/power"
)
// An approximation to chain state finality (should include message propagation time as well).
const... |
92789154b6b82cc46d1bd92b28f8f5646e510455 | 1c6714331dec0fa0601b09ef9b99c56266776183 | mackerelio/mackerel-agent-plugins | /mackerel-plugin-conntrack/lib/main.go | Go | go | 341 | permissive | package mpconntrack
import (
"os"
)
// Name is executable name of this application.
const Name string = "mackerel-plugin-conntrack"
// Version is version string of this application.
const Version string = "0.1.0"
// Do the plugin
func Do() {
cli := &CLI{
outStream: os.Stdout,
errStream: os.Stderr,
}
os.Exit... |
e68ba133d49792a36f5912f34b761a4cc58e8551 | 07286480376c6f288b78da3011e7f6cc37b497a4 | SmartsYoung/gbp | /concurrency-patterns/0-3-select-timeout.go | Go | go | 1,311 | permissive | /**
* File: select_timeout.go
* Brief: 并发超时处理
* Descr:
*
* Author: Hong Li, leehongitrd@163.com
* Github: https://github.com/researchlab
* Created: 2016-02-18 16时10分24秒
* Modified: 2016-02-18 16时10分24秒
**/
package main
import (
"errors"
"net/http"
"time"
"github.com/researchlab/gdk/net"
)
var url = "... |
685d04ff4c63ca6eee5e84bb8efc2fafea12ed92 | 58c71012906e987d6bd854692920f8a97d63a464 | lightsofapollo/srtp | /session_srtp.go | Go | go | 4,193 | permissive | package srtp
import (
"errors"
"fmt"
"net"
"github.com/pion/logging"
"github.com/pion/rtp"
)
const defaultSessionSRTPReplayProtectionWindow = 64
// SessionSRTP implements io.ReadWriteCloser and provides a bi-directional SRTP session
// SRTP itself does not have a design like this, but it is common in most appl... |
40c2819f22c79086085e3758a9fca75a23beee75 | 7670dd1852c986c583b3ee2c133bf2a6501ddb25 | kubesphere/s2irun | /vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllerutil/example_test.go | Go | go | 2,006 | permissive | /*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
307a733d186b4993cfc11a8f622d019aa30d77aa | 48bdb489015e4d38c83cc0c53e72db0276b6fd16 | DalavanCloud/certificate-transparency | /go/fixchain/ratelimiter/limiter_test.go | Go | go | 1,388 | permissive | package ratelimiter
import (
"sync"
"testing"
"time"
)
var testlimits = []int{1, 10, 50, 100, 1000}
func TestRateLimiterSingleThreaded(t *testing.T) {
for i, limit := range testlimits {
l := NewLimiter(limit)
count := 0
tick := time.NewTicker(time.Second)
go func() {
for range tick.C {
// Allow a ... |
3e2bfca1efb8c201d9e7091b7af6ff54ab079ace | 866415a90649439f482f08d8d0afbdeee3d3680c | eviabs-fiverr/book_service | /main.go | Go | go | 3,330 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"path"
"strings"
)
func ShiftPath(p string) (head, tail string) {
p = path.Clean("/" + p)
i := strings.Index(p[1:], "/") + 1
if i <= 0 {
return p[1:], "/"
}
return p[1:i], p[i:]
}
func notFoundHandler(res http.ResponseWriter, req *http.Request) {
... |
64891b64a8bbf6d5f0cec1cdf4bbf8a9421bd215 | 7dbfa5ac5a8bca652d21a0996ed6cdd7a90d4a89 | izogain/demoinfocs-golang | /fake/parser_test.go | Go | go | 3,126 | permissive | package fake_test
import (
"testing"
"time"
assert "github.com/stretchr/testify/assert"
common "github.com/markus-wa/demoinfocs-golang/common"
events "github.com/markus-wa/demoinfocs-golang/events"
fake "github.com/markus-wa/demoinfocs-golang/fake"
msg "github.com/markus-wa/demoinfocs-golang/msg"
)
func Test... |
2e87acbd0cd80f222ca7cde8dda0dd8ce7a8a08a | 23b288c2104af62468ccce361589abffdf76e6d8 | thecharge/iso20022 | /sese/PEPOrISAOrPortfolioTransferInstructionV02.go | Go | go | 7,518 | permissive | package sese
import (
"encoding/xml"
"github.com/fgrid/iso20022"
)
type Document01200102 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:sese.012.001.02 Document"`
Message *PEPOrISAOrPortfolioTransferInstructionV02 `xml:"PEPOrISAOrPrtflTrfInstrV02"`
}
func (d *Do... |
2369e79f4be806063a9171d975c1fe173ea82569 | 0905f82225c573e9221461727671724df1bf4b72 | thanhtungka91/leetcode-go | /interface/celsius_flag.go | Go | go | 1,088 | no_license | package main
import (
"flag"
"fmt"
)
type Celsius float64
type Fahrenheit float64
type celsiusFlag struct {
Celsius
}
func (f *celsiusFlag) Set(s string) error {
var unit string
var value float64
fmt.Sscanf(s, "%f%s", &value, &unit)
switch unit {
case "C":
f.Celsius = Celsius(value)
return nil
case ... |
1cec7e4e0c6bd8db41a99e3a87dcb1e669d71697 | 24be4c42ac93cd426642bf6330d81ca0073e1b0b | elastic/uptd | /updater.go | Go | go | 2,467 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
736fe7e297a0911ae55df5f151e4830e3a148955 | 04d740ca6ca98986c260d3c70226d691b54404e2 | nayaksamdeep/tinyurl | /Models/Model.go | Go | go | 860 | no_license | package Models
import (
//"time"
)
type RedirectUrl struct {
ID uint `json:"id"`
Url string `form:"url" json:"url" binding:"required"`
TinyUrl string `json:"tinyurl"`
//CreatedDate time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_date"`
//ExpiryDate time.Time `gorm:"default.CURRENT_T... |
a73f7ec03daf2bfede07e7ca88f5fc1762bbe32e | 136531d12940ae9fcde6a3512ea12904eafce0bd | gfragoso/golang | /fundamentos/conversoes/conversoes.go | Go | go | 471 | no_license | package main
import (
"fmt"
"strconv"
)
func main() {
x := 2.4
y := 2
fmt.Println(x / float64(y))
nota := 6.9
notaFinal := int(nota)
fmt.Println(notaFinal)
// cuidado...
fmt.Println("Teste " + string(97))
// int para string
fmt.Println("Teste " + strconv.Itoa(123))
// string p... |
e44d1e6a218bed261860b1b6f7e4bfdab32c34e6 | d55e7254e514d82994c1c953a99b21f502dd00f7 | feisuzhu/rook | /cmd/rook/ceph/operator.go | Go | go | 4,539 | permissive | /*
Copyright 2016 The Rook 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 agreed to ... |
4aeaca6b2655fbcd17ffadef2d74414bf7893ab0 | 84edd5c4984b704261be9d876c20c5bd8178786a | golint-fixer/go-mqtt | /packet/type_test.go | Go | go | 1,545 | permissive | package packet
import (
"testing"
)
func TestTypeName(t *testing.T) {
if s := TReserved.Name(); s != "RESERVED" {
t.Errorf("TReserved.Name() returns %s", s)
}
if s := TConnect.Name(); s != "CONNECT" {
t.Errorf("TConnect.Name() returns %s", s)
}
if s := TConnACK.Name(); s != "CONNACK" {
t.Errorf("TConnACK.... |
44dd698fae3a4c89a6410446354c5fc2a55047fa | db76440acee6a8ff24e2fa0ea2d1dc36b27d41d0 | shortthirdman/code-eval-challenges | /moderate/pangrams_test.go | Go | go | 754 | permissive | package main
import (
"strings"
"testing"
)
func TestPangram(t *testing.T) {
for k, v := range map[string]string{
"A quick brown fox jumps over the lazy dog": "NULL",
"A slow Yellow fox crawls Under the proactive dog": "bjkmqz"} {
if r := pangram(k); r != v {
t.Errorf("failed: pangram %s is %s, got... |
d4d930cc5e652cd4f3c4aed25936f2e8d5a3d5e7 | 507401a23428d7a58095aa2ee9f0a42019bd7c19 | jarlyyn/hellclient | /src/modules/world/component/log/log.go | Go | go | 1,305 | permissive | package log
import (
"hellclient/modules/app"
"hellclient/modules/world/bus"
"log"
"os"
"path/filepath"
"sync"
"time"
"github.com/herb-go/logger"
"github.com/herb-go/util"
)
type Log struct {
Locker sync.RWMutex
}
func (l *Log) InstallTo(b *bus.Bus) {
dolog := b.WrapHandleError(l.DoLogError)
debug := b.... |
42373223eab6b0cda98b206325334c8e81073f06 | 413bcce8c02d13700fc47322292a4c2f56c4ccf6 | DavidBenko/gateway | /src/gateway/core/request/redis.go | Go | go | 3,512 | permissive | package request
import (
"encoding/json"
"errors"
"fmt"
"gateway/db/pools"
"gateway/db/redis"
"gateway/logreport"
"gateway/model"
"strings"
redigo "github.com/garyburd/redigo/redis"
)
type RedisRequest struct {
Config *redis.Spec `json:"config"`
Arguments []string `json:"arguments"`
conn redig... |
35e9bf3553a1b411155532efab7aa3d27a294dff | d0d55d67361d2a6b3cf28da681e0f0bb2fd4a338 | developgo/aranya | /cmd/arhat/internal/runtime/podman.go | Go | go | 873 | permissive | // +build linux,rt_podman
/*
Copyright 2019 The arhat.dev 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... |
9691654690aee17be7df794ce6701b75e21edba0 | ac98813ade73ff98ddfbbefe5599aebe24f8d229 | wealdtech/ethdo | /cmd/slot/time/output.go | Go | go | 1,085 | permissive | // Copyright © 2021 Weald Technology Trading
// 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 a... |
d8018d3380e0d363494a0e594289a34a0a24d45d | b00b6b8298aa032b2d19f3b6cd0319946761ca57 | kubernetes/kubernetes | /staging/src/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go | Go | go | 1,701 | permissive | /*
Copyright 2022 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, ... |
e443d06e117ae619fa58cf974f19bedc8702485d | 7da6ef14e4eb7aab3fbcb90aa874f0eeb1d5423e | agrrh/terraform-provider-netbox | /plugin/providers/netbox/resource_netbox_vlans.go | Go | go | 2,297 | permissive | package netbox
import (
// "errors"
// "fmt"
// "strconv"
"log"
"github.com/Preskton/go-netbox/netbox/client/ipam"
"github.com/hashicorp/terraform/helper/schema"
)
// resourceNetboxAddress returns the resource structure for the netbox_address
// resource.
//
// Note that we use the data source read function he... |
a4527a9fc4499461458be92e718c39322140b293 | 3bc850566c1008d635f36c9979b4ec72e87c85fe | matthewloring/core | /x/ref/lib/vdl/codegen/swift/util_file.go | Go | go | 749 | permissive | // Copyright 2015 The Vanadium 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 swift
import (
"errors"
"path/filepath"
"strings"
)
func (ctx *swiftContext) vdlRootForFilePath(absolutePath string) (string, error) {
if !s... |
b4dab6d8f8311b8b26c5eeb7e9356e6b08b2ccc8 | d3cc37d5816b4881ad46acaedad56a6efbf94646 | sourcegraph/sourcegraph | /internal/cmd/tracking-issue/api.go | Go | go | 3,342 | permissive | package main
import (
"context"
"fmt"
"sort"
"strings"
"github.com/machinebox/graphql"
)
// ListTrackingIssues returns all issues with the `tracking` label (and at least one other label)
// in the given organization.
func ListTrackingIssues(ctx context.Context, cli *graphql.Client, org string) ([]*Issue, error)... |
c8d2bb61d0f733aec8068696408e95a8c315050e | a7ee6f2f7e82e81983f8c5ef1b122df61ae034ea | google/note-maps | /note/notetest/notestest.go | Go | go | 1,865 | 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 ... |
1d71fd27946f02db50735268ac8494b14bb2200c | dd2225bbc78da7772647902081d3e27ced229805 | antomatic/terraform-provider-aiven | /aiven/resource_vpc_peering_connection_test.go | Go | go | 2,637 | permissive | package aiven
import (
"fmt"
"os"
"reflect"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func TestAccAivenVPCPeeringConnection_basic(t *testing.T) {
if os.Getenv("AWS_REGION") == "" ||
os.Getenv("AWS_VPC_ID") == "" ||
os.Getenv("AWS_ACCOUNT_ID") == "" {
t.Skip("env variables... |
252b010e635c3faed4e0346049c65892c1e3bd15 | cff7777b2008c73a8ac29689aaa6ee7593e9caa1 | bodogbo/gop | /cmd/ensure.go | Go | go | 7,855 | no_license | // Copyright 2017 The Gop 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"
"fmt"
"go/build"
"io"
"os"
"path"
"path/filepath"
"strings"
"github.com/Unknwon/com"
"github.com/lunny/gop/util"
"gi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.