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 |
|---|---|---|---|---|---|---|---|---|
ae3d5eb75cdef1ae8d8648aa31ab77eb0e1026c1 | e2ea8fb0bef8ab93ae30bab9ec2fd6376abbfa43 | soham-aubergine/rentroll | /rcsv/loadasmtcsv.go | Go | go | 11,242 | no_license | package rcsv
import (
"fmt"
"rentroll/rlib"
"strings"
)
// ValidAssessmentDate determines whether the assessment type supplied can be assessed during the assessment's defined period
// given the supplied Rental Agreement period.
// Returns true if the assessment is valid, false otherwise
func ValidAssessmentDate(a... |
2919dad4d3bcfc15d9713d2a1aca905ecb356395 | bf0cdb24f858436f4aa02fe245cc4354f20eb86c | machacekondra/containerized-data-importer | /tests/utils/pod.go | Go | go | 9,639 | permissive | package utils
import (
"fmt"
"strings"
"time"
"github.com/onsi/ginkgo"
k8sv1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
)
const (
// PodWaitForTi... |
edd8fbe0e8527e7825a39632b8c60190c465218c | 9118ae204a29e55e4282f0d6bf73b6a2234e440c | zhangmb-git/GoTest | /test6/vendor/github.com/apache/rocketmq-client-go/v2/consumer/push_consumer.go | Go | go | 36,233 | permissive | /*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this fi... |
8b0eb55ed7f47be030e46577967128a4835946e9 | 4938aa5489ab147239de58a9e57e1bc6cd76f2b0 | ralexstokes/rumor | /chain/db/blocks/mem.go | Go | go | 4,151 | permissive | package blocks
import (
"bytes"
"context"
"fmt"
"github.com/protolambda/zrnt/eth2/beacon"
"github.com/protolambda/zrnt/eth2/util/ssz"
"github.com/protolambda/zssz"
"io"
"sync"
"sync/atomic"
)
type MemDB struct {
// beacon.Root -> []byte (serialized SignedBeaconBlock)
data sync.Map
removalLock sync.... |
5297e971514b7bc160dac2346b898e4dbe2b058b | ee75629cd7c10092bcc63832afcad09f2c9216d4 | mistsys/protobuf3 | /protobuf3/lib.go | Go | go | 11,512 | permissive | // Go support for Protocol Buffers - Google's data interchange format
//
// Modifications copyright 2016 Mist Systems.
//
// Original code copyright 2010 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, ... |
3c3b7479d35158c67f8513e75d8fd1a48232a167 | f178bf37d688e1d17fe3074525c75105dffe1c0e | haiheipijuan/btcd | /cmd/findcheckpoint/config.go | Go | go | 5,020 | permissive | // Copyright (c) 2013-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/btcsuite/btcutil"
"github.com/haiheipijuan/btcd/chaincfg"
"github.com/haiheipijuan/btcd/database"
_... |
d61706c7e413c702a32768b24f66a9f4a61dcfac | 539eadb8e59d5520c23b2068f2317d321b47cb04 | rach/pome | /scheduler.go | Go | go | 1,189 | permissive | package main
import (
"github.com/rach/pome/Godeps/_workspace/src/github.com/jmoiron/sqlx"
"github.com/robfig/cron"
"strings"
)
func scheduleMetric(c *cron.Cron, schedule string, fct func()) {
c.AddFunc(schedule, fct)
if strings.HasPrefix(schedule, "@every") {
fct()
}
}
func initScheduler(
db *sqlx.DB,
met... |
3e3e3100ab8647400c785ac7a6a74860f761194a | aa7f4d6f59ad862e29969a686b3530c3b375708a | marcaurele/istio | /pilot/pkg/xds/eds_test.go | Go | go | 29,179 | 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... |
ddfe9ddc580bc2f32467445c25dccb620f979fb0 | 1440a17cdc4d93109807e2c7b7a0d5d2e6c6a029 | youbinqiu/gogs | /routers/api/v1/repo/issue.go | Go | go | 4,242 | permissive | // Copyright 2016 The Gogs 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 repo
import (
"fmt"
"strings"
api "github.com/gogits/go-gogs-client"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/context"
... |
2d04f292624a778a6f6645a3e591531b69b807f7 | 81a3a80638aabbe5e675740b931f5b57645be2d8 | xingyushu/gin_pro | /blog/pkg/setting/setting.go | Go | go | 1,237 | no_license | package setting
import (
"log"
"time"
"github.com/go-ini/ini"
)
var (
Cfg *ini.File
RunMode string
HTTPPort int
ReadTimeout time.Duration
WriteTimeout time.Duration
PageSize int
JwtSecret string
)
func init() {
var err error
Cfg, err = ini.Load("conf/app.ini")
... |
ab080b96faf654eba35baeb0b640c2bb12510966 | 260e680d46802d3039c62c6ba270efb992c84c76 | yhat/resize | /Godeps/_workspace/src/github.com/yhat/middleware/log.go | Go | go | 1,658 | permissive | package middleware
import (
"bufio"
"fmt"
"io"
"net"
"net/http"
"time"
)
const defaultStatus int = -1
type statusWrapper struct {
wr http.ResponseWriter
status int
nbytes int
}
func (w *statusWrapper) Header() http.Header { return w.wr.Header() }
func (w *statusWrapper) WriteHeader(status int) {
w.wr... |
88fa1fd3c0905e7de84f5595786dad96b09d65f1 | 73586e393d1a23c763294fcb01d30ea97dd187da | andreatulimiero/scion | /go/lib/slayers/path/onehop/onehop.go | Go | go | 3,592 | permissive | // Copyright 2020 Anapaya Systems
//
// 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... |
4695ce1b9b8fb44c582c47f267d90e7434981a4a | fb271d15f7266e7cbd5a98fd49c434d021828901 | longnhong/btquan | /x/socket/box.go | Go | go | 1,533 | no_license | package socket
import (
"encoding/json"
"strings"
"github.com/golang/glog"
"github.com/gorilla/websocket"
)
type Box struct {
Clients WSClients
Groups WSGroups
handlers Handlers
}
type Handlers map[string]func(r *Request)
func NewBox() *Box {
return &Box{
Clients: WSClients{},
Groups: WSGroups{},
... |
cd6b7c0de616b53e4b3720ba9487abba70d267fa | 57d57452568ae6596ab8470bf38cb01746a91a4c | RZebec/Sem5_prog | /ticketsystem/webserver/core/validation/passwordRequirements/validator.go | Go | go | 896 | no_license | // 5894619, 6720876, 9793350
package passwordRequirements
import (
"unicode"
)
/*
A validator for password requirements.
*/
type Validator struct {
}
/*
Create a new validator.
*/
func NewValidator() *Validator {
validator := Validator{}
return &validator
}
/*
Validate a password against the requirements. Ret... |
a0a3ae9884c3307d8c8c018f04798b6d3d1c7cbe | 91b728cb67f2ec73078895132257a759d7bf9e60 | mrsufgi/projects-manager | /pkg/transport/response.go | Go | go | 661 | permissive | package transport
import (
"encoding/json"
"fmt"
"net/http"
)
// ResponseError represent the reseponse error struct
func (e *ResponseError) WriteToResponse(w http.ResponseWriter) {
w.WriteHeader(e.HTTPStatus)
fmt.Fprint(w, e.ToJSON())
}
func (e *ResponseError) ToJSON() string {
j, err := json.Marshal(e)
if e... |
948a118b2fed5972ea884c6f26446b71c1de50a0 | f95adfdc8c8b4fcd664440a28a83e3de30374834 | edgexfoundry/edgex-ui-go | /internal/handler/types.go | Go | go | 1,177 | permissive | /*******************************************************************************
* Copyright © 2022-2023 VMware, 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
*... |
7fcb5b3ce4efdd22d6de73c4d3653f81a5a96968 | 1cc4907c69f269723d724bff7338c02761b894e3 | amitkumarj441/kbfs | /vendor/github.com/keybase/client/go/logger/standard.go | Go | go | 9,464 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package logger
import (
"fmt"
"os"
"path/filepath"
"strings"
"sync"
logging "github.com/keybase/go-logging"
"golang.org/x/net/context"
keybase1 "github.com/keybase/client/go/protocol"
)
... |
0adb43f0648c54e9cdb1fdc9653a938c93d6f7f3 | 51c154c7af1d7ec55c75c4ef1e74b6f173a5e5a1 | molodofo/PracticeGolangInHackerRand | /ModifiedKaprekarNumbers.go | Go | go | 2,525 | permissive | /*
A modified Kaprekar number is a positive whole number n with d digits, such that when we split its square into two pieces - a right hand piece r with d digits and a left hand piece l that contains the remaining d or d−1 digits, the sum of the pieces is equal to the original number (i.e. l + r = n).
Note: r may have... |
c5c2f4f9af875c1348892865e646ed515b4365e9 | 0472432a8fb15430c2f8093a78cc6f0211526741 | openshift/installer | /vendor/github.com/microsoftgraph/msgraph-sdk-go/users/item/planner/tasks/item/planner_task_item_request_builder.go | Go | go | 12,450 | permissive | package item
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653dc691023836... |
b09fe2744a36dd525caab9edf4e33630a09130d5 | 39707be5be87520d2ddf6a89ddfde58b64b79b79 | nithinkumar030/bigmuddy-network-telemetry-pipeline | /vendor/github.com/influxdata/influxdb/models/points_test.go | Go | go | 62,106 | permissive | package models_test
import (
"bytes"
"fmt"
"math"
"math/rand"
"reflect"
"strconv"
"strings"
"testing"
"time"
"github.com/influxdata/influxdb/models"
)
var (
tags = models.NewTags(map[string]string{"foo": "bar", "apple": "orange", "host": "serverA", "region": "uswest"})
fields = models.Fields{
"int64"... |
103a79c291b2f7b9f78d0593790fa915dd24c073 | 36959a7e28b7466ab58bf5f644950096e102dd2b | dongxinb/go-shadowsocks2 | /tcp.go | Go | go | 4,036 | permissive | package main
import (
"io"
"net"
"time"
"github.com/dongxinb/go-shadowsocks2/socks"
)
// Create a SOCKS server listening on addr and proxy to server.
func socksLocal(addr, server string, shadow func(net.Conn) net.Conn) {
logf("SOCKS proxy %s <-> %s", addr, server)
tcpLocal(addr, server, shadow, func(c net.Conn... |
3861e49bef495f3325cbc0d55736369162897f4d | 59b0a81ffa5e1999127ab42793ed6dea652c7b69 | michaelhan-111/golang | /oncall_helper/oncall_helper.go | Go | go | 17,421 | no_license | package main
import (
"bufio"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"syscall"
"time" // "gopkg.in/gomail.v2"
"gopkg.in/yaml.v2"
)
// Variable declarations
const (
B = 1
KB = 1024 * B
MB = 1024 * KB
GB = 1024 * MB
)
type MountDirPath struct {
mountpath string
d... |
13a750c74ffca9ff67ee75a0785434e2a1a43c04 | d3764826ee4ff071645d3954bc7af4f7b1c07bec | keaty/bosh-provisioner | /Godeps/_workspace/src/github.com/cloudfoundry/bosh-agent/blobstore/local_blobstore_test.go | Go | go | 4,497 | no_license | package blobstore_test
import (
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/blobstore"
fakesys "github.com/cloudfoundry/bosh-agent/system/fakes"
fakeuuid "github.com/cloudfoundry/bosh-agent/uuid/fakes"
)
var _ = Describe("localBlobstore", func() {
var ... |
20aca9e26d157a6906d0b79fb21afaeec1c91379 | 3b8bf9557e72858dd9cd5ce70f3113821f6bbbf4 | CodeFreezr/gobyes | /corpus/golangsam/AnyType/chan/ss/standard/archive/zip/ChanReader.dot.go | Go | go | 8,754 | permissive | // Copyright 2017 Andreas Pannewitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package zip
// This file was generated with dotgo
// DO NOT EDIT - Improve the pattern!
import (
zip "archive/zip"
)
// MakeReaderChan returns a new open... |
9490f79cc9c37c725dffd62bd587cb6aeaa47abb | 7e4a38567ec0c59a2b76dcf5c7172af50590eeb1 | openshift/installer | /terraform/providers/alicloud/vendor/github.com/hashicorp/terraform-svchost/disco/http_transport.go | Go | go | 605 | permissive | package disco
import (
"net/http"
"github.com/hashicorp/go-cleanhttp"
)
const DefaultUserAgent = "terraform-svchost/1.0"
func defaultHttpTransport() http.RoundTripper {
t := cleanhttp.DefaultPooledTransport()
return &userAgentRoundTripper{
innerRt: t,
userAgent: DefaultUserAgent,
}
}
type userAgentRound... |
922135fa8a4df219f1bad40b841ea63cdabe56a7 | 9f6516b47f70dad46ddf23f6f88f596fea459284 | TopBlockChain/fabric-sdk-go | /fabcli/fabric-cli/cmd/fabric-cli/query/queryblockcmd.go | Go | go | 3,160 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package query
import (
"encoding/base64"
"strings"
"github.com/hyperledger/fabric-sdk-go/pkg/client/ledger"
fabricCommon "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/com... |
d5759d4ed43571f3745d32489eca855cbd241051 | a69d66c74d7962f889d299bcfb7ff0366e232222 | olehan/marker | /utils/service.go | Go | go | 207 | permissive | package utils
import "math/rand"
func RandomStringRunes(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}
|
f34582643be2b00ed9b0c2f26f953ec954c8f8ec | 76cb3e2bf612ff59836bdbd4b6f90c334dae61d0 | microsoftgraph/msgraph-beta-sdk-go | /rolemanagement/enterprise_apps_item_role_assignment_schedule_requests_filter_by_current_user_with_on_response.go | Go | go | 5,472 | permissive | package rolemanagement
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
)
// EnterpriseAppsItemRoleAssig... |
2abb0d0af4789ad3bd606a581ab2873308c749ff | 4472ec7024ed1710fc405391220b9fdee85ef783 | xychen/algorithms | /leetcode/0322.coin-change/0322.coin-change-2.go | Go | go | 682 | no_license | package problem0322
// 零钱兑换
// 方法二: 回溯 + 记忆化搜索
const INT_MAX = int((^uint(0) >> 1))
var MAX_RES int
var dp map[int]int
func coinChange2(coins []int, amount int) int {
MAX_RES = amount + 1
dp = make(map[int]int)
res := solve(coins, amount)
if res == MAX_RES {
return -1
}
return res
}
func solve(coins []int, ... |
6fe4ac741f4635dab8baac47a8fe622d02552b8c | 26e707b9565cb1a4e5bb0fea7e4b13f23f02a5a6 | nyrahul/cilium | /vendor/github.com/cilium/ebpf/internal/epoll/poller.go | Go | go | 4,664 | permissive | package epoll
import (
"fmt"
"math"
"os"
"runtime"
"sync"
"github.com/cilium/ebpf/internal"
"github.com/cilium/ebpf/internal/unix"
)
// Poller waits for readiness notifications from multiple file descriptors.
//
// The wait can be interrupted by calling Close.
type Poller struct {
// mutexes protect the fiel... |
49cfaf52c63ab1392aff2c194b369a32aef8ac1e | 67614e3420a32aefe1cf2cbf200f5be7a4961c67 | Madongming/iotex-core | /action/grantreward.go | Go | go | 3,001 | permissive | // Copyright (c) 2019 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... |
3de7d4e3dfef91567913b86497aba5091e71ea78 | 022f0fb38e0d5285ee5f1a5bcd61a4e477f27c2f | NikolaeVarius/goroslib | /msgs/std_msgs/int8_multi_array.go | Go | go | 230 | permissive | // Autogenerated with msg-import, do not edit.
package std_msgs
import (
"github.com/aler9/goroslib/msgs"
)
type Int8MultiArray struct {
msgs.Package `ros:"std_msgs"`
Layout MultiArrayLayout
Data []msgs.Int8
}
|
992fe8c76be478eb979671d2e1769aa9fa2d708e | fc4c044e737dcb19eb370077c252674779c2df6b | sallyom/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_resource.go | Go | go | 10,171 | permissive | package aadb2c
import (
"context"
"fmt"
"net/http"
"time"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-pro... |
16a79b4e69bf320dc545400c0d931a6716412a44 | 02a24993fa227426f918b998eef14b5381331733 | MisinformedDNA/pulumi-azure-nextgen | /sdk/go/azure/network/v20181001/serviceEndpointPolicy.go | Go | go | 8,014 | 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 v20181001
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Service End point policy resource.
type ServiceE... |
941aff80b1ca7fc375539e9cda25ac9c497f3da9 | 226413cc1906720a59c59a1d52e6d4bec008a72e | FM-FE/crawler | /go/src/learngo/findstring/findstring.go | Go | go | 972 | no_license | package main
import (
"fmt"
"strings"
)
func findCar(contents [][][]byte) string {
for _, m := range contents {
for _, n := range m {
str := string(n)
if strings.Contains(str, "车") {
return str
}
}
}
return "not found "
}
func findHouse(contents [][][]byte) string {
for _, m := range contents ... |
18320970466fb056d31c5153c5c2e4d7cfa04470 | dd6d80a7376a18a54ac9a1056517563dff19aeb3 | dustintownsend/origin | /pkg/cmd/server/start/config_test.go | Go | go | 10,069 | permissive | package start
import (
"strings"
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
clientcmdapi "github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd/api"
"github.com/openshift/origin/pkg/cmd/util"
)
func TestMasterURLNoPathAllowed(t *testing.T) {
masterArgs := NewDefaultMast... |
21a9060bd36e0ce85cf10c6de00d02904c6a52d3 | 4388963e21c232bc243a5e78a27b7e1084c027fb | advance512/rack | /pkg/cli/resources_test.go | Go | go | 17,805 | permissive | package cli_test
import (
"context"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net"
"testing"
"time"
"github.com/convox/rack/pkg/cli"
mocksdk "github.com/convox/rack/pkg/mock/sdk"
"github.com/convox/rack/pkg/options"
"github.com/convox/rack/pkg/structs"
"github.com/stretchr/testify/mock"
"github.com/stretchr/t... |
779405e740732f70bf1e2ee597347103920c7324 | 4b686a7d9a50d78de180adf7302cbc1c854dd334 | Dmdv/go-micro-example | /v4/mqtt/client/main.go | Go | go | 1,376 | permissive | package main
import (
"context"
"fmt"
"time"
"github.com/asim/go-micro/plugins/broker/mqtt/v4"
"github.com/google/uuid"
pb "github.com/xpunch/go-micro-example/v4/mqtt/proto"
"go-micro.dev/v4"
"go-micro.dev/v4/client"
"go-micro.dev/v4/logger"
)
type message struct {
ID string `json:"id"`
Message s... |
768800f83208a0448aed894641a09fce37b5c293 | 1d02dd9eb1f3af89ed4c6c15f16635a9094f15e1 | jonahzheng/ion-sfu | /cmd/signal/grpc/server/server.go | Go | go | 8,006 | permissive | package server
import (
"encoding/json"
"fmt"
"io"
log "github.com/pion/ion-log"
pb "github.com/pion/ion-sfu/cmd/signal/grpc/proto"
"github.com/pion/ion-sfu/pkg/sfu"
"github.com/pion/webrtc/v3"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type SFUServer struct {
pb.UnimplementedSFUServe... |
a7bb4f4e69e682e8c1a00f895713ea439c86628c | de1d5c970fbbc05cc1e9100389d4fe94a163451a | lichnak/multicloud-k8s | /src/dcm/api/api.go | Go | go | 5,760 | permissive | /*
Copyright 2020 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 agreed to in writing, software... |
5f6262171eb86ffe9d60b481e9e7a20e139c1161 | 61b3a5dd6d7e215f71d52fa26f4df6b3f4133dd5 | SubLuLu/data-structures | /list/double_list_test.go | Go | go | 1,306 | no_license | package list
import (
"fmt"
"testing"
)
// 双链表测试
var dl = NewDoubleList()
func TestDoubleList_Add(t *testing.T) {
fmt.Println(t.Name())
err := dl.Add(15)
if err != nil {
t.Fatal(err)
}
}
func TestDoubleList_Append(t *testing.T) {
fmt.Println(t.Name())
err := dl.Append(12)
if err != nil {
t.Fatal(err)... |
9a0df39a2a7d231bc2ccb715a332f5ee728e9710 | 1ed7cf547cfe6fa494e63ffd7a719215f842d6bc | cruz-victor/ConcurrenciaGorutinaGolang | /EjercicioPracticoNivel9.go | Go | go | 2,377 | no_license | package main
import (
"fmt"
"runtime"
)
//------------Ejercicio 1
/*
var wg sync.WaitGroup
func gourutina1() {
fmt.Println("soy la gourutina 1")
wg.Done()
}
func gourutina2() {
fmt.Println("soy la gourutina 2")
wg.Done()
}
func main() {
fmt.Println("numero de NumCPU:", runtime.NumCPU())
fmt.Println("numero... |
7f02a2f77906e0f5d9b2e520bf620e6b96763cbb | 37850a5fb46240402ae810bd6e516e0012968087 | sylabs/sif | /pkg/integrity/doc.go | Go | go | 1,508 | permissive | // Copyright (c) 2020-2022, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
/*
Package integrity implements functions to add, exami... |
4708cfb3c8193c9d729cf2985ddf07cf6fec125c | 532c071244b97a55fd6cc07a4e69610ef7a53a91 | kgbu/fuji | /tests/ini_retain_test.go | Go | go | 4,572 | permissive | // Copyright 2015 Shiguredo Inc. <fuji@shiguredo.jp>
//
// 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 applicabl... |
f33c167d28145182e34e211d4cab232a50250b5c | dab7da2ae7cd51bc89009f4ade2236e75b41a8ca | trustbloc/fabric-peer-ext | /pkg/collections/offledger/dcas/client/provider.go | Go | go | 6,119 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package client
import (
"io"
"github.com/bluele/gcache"
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric/common/flogging"
"github.com/pkg/errors"
olclient "github.com/trustbloc... |
a5aa646b2eb955a26c3be7982c5f3feb1ea1fe40 | 7ff8a8d3e789cb5885d727f97fcf94f95d27c24d | cemremengu/srclient | /mockSchemaRegistryClient_test.go | Go | go | 3,339 | permissive | package srclient
import (
"fmt"
"sort"
"testing"
"github.com/stretchr/testify/assert"
)
/*
We are going to test the client meant to be used for testing
*/
var srClient MockSchemaRegistryClient
var schema = "{ " +
"\"type\": \"record\", " +
"\"namespace\": \"com.mycorp.mynamespace\", " +
"\"name\": \"value... |
0d739e423d1ba31dbb4a1d7f7782821cbabe1c01 | 49a3a05cc28267020586b0b627c96295dc866087 | suffuse/go-suffuse | /suffuse/opts.go | Go | go | 2,355 | permissive | package suffuse
import (
"github.com/docopt/docopt-go"
)
func sfsUsage()string {
return TrimSpace(`
Usage: suffuse [-v | -vv | -vvv] [-t | -m PATH] [-n VOLNAME] [-c PATH] PATH
Arguments:
PATH existing filesystem
Options:
-c PATH suffuse config file
-m PATH mount point
-n VOLNAME volume name (O... |
2e9b3f8f6f2322ca04eae28ed1b344221edbe59e | 3103fd4de2de20ab2c9b944e0e62facb02917aa5 | codeclimate-testing/hugo | /hugolib/shortcodeparser_test.go | Go | go | 8,837 | permissive | // Copyright 2015 The Hugo 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 ... |
f961cf4c12b3903809d511de89f0e6c392070178 | 898ea94bc8a9b1cd907f3f2730f3cd9998fd52a8 | PacktPublishing/Mastering-Go-Second-Edition | /ch05/doublyLList.go | Go | go | 1,479 | permissive | package main
import (
"fmt"
)
type Node struct {
Value int
Previous *Node
Next *Node
}
func addNode(t *Node, v int) int {
if root == nil {
t = &Node{v, nil, nil}
root = t
return 0
}
if v == t.Value {
fmt.Println("Node already exists:", v)
return -1
}
if t.Next == nil {
temp := t
t.Nex... |
1e3f1ca650e0d16e9934dfa45e18765756b87291 | 093164debc4a0b559b24b25cfc30a6a5c6703550 | WhatIETF/goRIPT | /ript_client/main.go | Go | go | 7,365 | permissive | package main
import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/WhatIETF/goRIPT/api"
"github.com/WhatIETF/goRIPT/ript_net"
"github.com/google/uuid"
"github.com/gordonklaus/portaudio"
)
// info about the provider
type riptProviderInfo struct {
baseUrl string
trunkGroups []a... |
fdafdf1352cd3675cdbdc71033c91e46c0ba5a0f | d77ae98a0b4fc9def3d0c47a2f33aaa0345e4ffa | fossabot/go-atlassian | /jira/sm/request.go | Go | go | 11,417 | permissive | package sm
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
)
type RequestService struct {
client *Client
Type *RequestTypeService
Approval *RequestApprovalService
Attachment *RequestAttachmentService
Comment *RequestCommentService
Participant *RequestParticipant... |
fe2e5ec0b6bc5a763944906ab4f9a579eb615d5c | 2c59954051aa1f598ac2e399d7f7481ea1050509 | cabify/go-couchdb | /auth_test.go | Go | go | 1,417 | no_license | package couchdb_test
import (
"net/http"
"testing"
"github.com/cabify/go-couchdb"
)
func TestBasicAuth(t *testing.T) {
tests := []struct{ username, password, header string }{
{"", "", "Basic Og=="},
{"user", "", "Basic dXNlcjo="},
{"", "password", "Basic OnBhc3N3b3Jk"},
{"user", "password", "Basic dXNlcj... |
23edbf962c1c86f433b67e1decb1a238ec421578 | 2d7968e16b9983dfd4ca4bc4f7457ac2469586bd | iostrovok/aerospike_etcd_cache | /etcdaero/aero.go | Go | go | 3,379 | no_license | package etcdaero
import (
"log"
"sync"
"time"
)
const (
// 10,05 mins
aerospikeTTL = 10050 * time.Millisecond
)
// IEntryData data buffer for export and import
type IAeroBody interface {
Get(data []interface{}) (interface{}, bool, error)
ReNew(data []byte) error
}
type AeroChecker struct {
sync.RWMutex
Con... |
3185609eb710041096dcb23243b6f6aedefc9403 | 236968b3412827ab603608ba0f1f0c41abd5474e | trantor-library/hummin | /print.go | Go | go | 2,723 | permissive | package main
import (
"fmt"
"github.com/ttacon/chalk"
)
func printUsage(prog string) {
fmt.Println(prog, "[command [args]]")
fmt.Println("Commands: book, get, search, news")
}
func printErr(msg string, err error) {
fmt.Println(chalk.Red, msg, err, chalk.Reset)
}
func printLoading() {
fmt.Println(chalk.Green,... |
8b1295a5d300fa90495bcc37eb5169f68696a2d5 | bf7ab2d37d69924fd315f9db0196933364f6869e | pearl-truss/mymove | /pkg/route/errors.go | Go | go | 4,676 | permissive | package route
import (
"fmt"
"github.com/transcom/mymove/pkg/models"
)
// ErrorCode contains error codes for the route package
type ErrorCode string
const (
// UnsupportedPostalCode happens when we can't map a ZIP5 to a set of Lat/Long
UnsupportedPostalCode ErrorCode = "UNSUPPORTED_POSTAL_CODE"
// UnroutableRo... |
f8d9c362b5893000fe860adc83bc41a8bbd269ce | 31e94e6033b8b33b8f423a1360514bf281a09afa | simongarisch/golang_stuff | /using_qt/qt_internal_examples/common/qml_demo/main.go | Go | go | 2,124 | no_license | package main
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/quick"
"github.com/therecipe/qt/widgets"
)
var (
centralLayout *widgets.QGridLayout
centralLayoutRow int
centralLayoutColumn int
)
func main() {
widgets.Ne... |
242be66f4e153d8cdb179e0f4e0bcdbe6bf61e83 | 432964bf28af468118adcd4674a38545a1810d58 | irairdon/kustomize | /plugin/someteam.example.com/v1/stringprefixer/StringPrefixer.go | Go | go | 1,571 | permissive | // Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"github.com/pkg/errors"
"github.com/irairdon/kustomize/v3/pkg/ifc"
"github.com/irairdon/kustomize/v3/pkg/resmap"
"github.com/irairdon/kustomize/v3/pkg/transformers"
"github.com/irairdon/kustomize/v3/pkg/transfo... |
ca4675199aea15440efd8a4a1fc33e6436113a0c | 21509f619463193a08995a6076b12b6feda0792f | bobo553/minigameServer | /minigameServer/controllers/RegController.go | Go | go | 3,390 | no_license | package controllers
import (
"bytes"
"context"
"crypto/md5"
"fmt"
"github.com/beego/beego/v2/server/web"
"io"
"minigameServer/models"
"regexp"
"strconv"
"time"
)
type RegController struct {
web.Controller
}
//注册处理
func (this *RegController) Post() {
username := this.Ctx.Request.Form.Get("username")
acco... |
15cc1a039fa77ca3224c9e23d1c5cf93ed50b675 | 1ff94044d7530ccf5a81dbd2fd9ed02262b1934f | uwstudent123/wio | /pkg/util/sys/types.go | Go | go | 694 | permissive | // Copyright 2018 Waterloop. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
// Package io contains helper functions related to io
// This file contains all the types for IO that the user can use
package sys
type IOHandler interface {
GetRoot() ... |
266e5fcf5666d51836a7722de58d7751ee49def8 | e7a4e7bdd3cc886e7ad81e9115d59a87047fa751 | linkerlin/gi | /pkg/importer/importer.go | Go | go | 3,535 | permissive | // Copyright 2015 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 importer provides access to export data importers.
package importer
import (
"github.com/gijit/gi/pkg/gostd/build"
"github.com/gijit/gi/pkg/priv/g... |
d774fb02be30ce8232128b9c29ac13b31e3178a1 | d4712caa7c6a0af9e96a718f0ab7ae3bdf0a51cd | goforce/eval | /scanner.go | Go | go | 3,017 | permissive | package eval
import (
"unicode/utf8"
)
type scanner struct {
src []byte // source
// current char and offset; nxOffset = offset + len of char
ch rune // current character
offset int // character offset
nxOffset int // next offset
// line and char counters for error location
linePos int // current li... |
dec551722af591ac06f7b2c6e84f941df20e0966 | 22c1a177b4010801d3e86e86448917a39cdb76d2 | leki75/cert-manager | /cmd/controller/app/options/options.go | Go | go | 14,413 | permissive | /*
Copyright 2019 The Jetstack cert-manager contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
ed364f84701f5c01289c2c5c296fc9936c556ef2 | a07694d33fbf39faacd7113d52ec6dfd6cbc0553 | dixudx/cluster-api | /vendor/github.com/go-openapi/loads/spec_test.go | Go | go | 17,592 | permissive | package loads
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
)
func TestUnknownSpecVersion(t *testing.T) {
_, err := Analyzed([]byte{}, "0.9")
assert.Error(t, err)
}
func TestDefaultsTo20(t *testing.T) {
d, err := Analyzed(PetStoreJSONMessage, "")
assert.NoError(t, err)
assert.NotN... |
ac43296c46a9554855cedfdf64547ef3b6f82a70 | 926c46e05c6d37bca6cb164ef6c4244f7a17d1a7 | moruowait/go2048 | /main.go | Go | go | 528 | permissive | package main
import (
"bufio"
"fmt"
"os"
)
func main() {
// 初始化棋盘 4x4
var board = NewBoard(4)
// 随机初始化 N 个数字
board.InitStartData(4)
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
if board.IsOver() {
fmt.Println("game over!")
return
}
switch scanner.Text() {
case "j", "l", "k", "i":... |
8f323dc59ece352b5ca2a3d16620c6cf118c8230 | 603b7b78af6c25e9405baad49a8b5649f7c87bbe | foxlegend/opentelemetry-collector | /exporter/exporterhelper/internal/bounded_memory_queue.go | Go | go | 4,478 | permissive | // Copyright The OpenTelemetry Authors
// Copyright (c) 2019 The Jaeger Authors.
// Copyright (c) 2017 Uber Technologies, 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
//
// ... |
76d098c475e77730c337cd68c3e593054d0595a1 | 75d34fb189354ddb6b3a7834be473b86e0e0d039 | shreddedbacon/bui | /bosh/payload_test.go | Go | go | 2,238 | permissive | package bosh_test
const stemcells = `[
{
"name": "bosh-warden-boshlite-ubuntu-trusty-go_agent",
"operating_system": "ubuntu-trusty",
"version": "3126",
"cid": "c3705a0d-0dd3-4b67-52b5-50533a432244"
}
]`
const releases = `[
{
"name": "bosh-warden-cpi",
"release_versions": [
{
... |
6552b818c110bcf6cac58712f4acee44735aa8ef | 4529f247879feccc1e6719b1a43562943b4ef343 | njdaniel/token | /routers/hello.go | Go | go | 310 | no_license | package routers
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"github.com/njdaniel/token/controllers"
)
func SetHelloRoutes(router *mux.Router) *mux.Router {
router.Handle("/test/hello", negroni.New(negroni.HandlerFunc(controllers.HelloController))).Methods("GET")
return router
}
|
bf69b358df07962f778c59a87113e8a901620946 | a2e0a714379a752ed3d7e6ac5fce66b3f1f122f3 | Mattlk13/oci-go-sdk | /tenantmanagercontrolplane/tenantmanagercontrolplane_recipientinvitation_client.go | Go | go | 14,702 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
f661a4dc910896db2aa54206ebf4cf834212695e | abd8e73e4ec025ee301049f2036a4b1552d21337 | radanalyticsio/oshinko-cli | /vendor/github.com/coreos/etcd/mvcc/watcher.go | Go | go | 4,476 | permissive | // Copyright 2015 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... |
2fe302dc21133bb4ae703f7193edf6d0108c2fb8 | d4af1bf57e9e6dc342d50ffee2b97cb79459eb23 | delba/api-paris | /main.go | Go | go | 619 | no_license | package main
import (
"fmt"
"github.com/delba/api-paris/models"
)
func handle(err error) {
if err != nil {
panic(err)
}
}
func main() {
var err error
err = FetchAndSaveCategories()
handle(err)
var categories models.Categories
err = categories.All()
handle(err)
for _, category := range categories {
... |
45c8a2f105cb6b2a5fd5bce7c319f2cfd7be06f6 | c71bb643d3d6fb4aa4c448025918522c4952468a | J0x47/mtail | /export_test.go | Go | go | 3,638 | permissive | // Copyright 2011 Google Inc. All Rights Reserved.
// This file is available under the Apache license.
package main
import (
"os"
"reflect"
"sort"
"testing"
"time"
"github.com/google/mtail/metrics"
)
func FakeSocketWrite(f formatter, m *metrics.Metric) []string {
var ret []string
lc := make(chan *metrics.La... |
8ae1c392a6c436c72b19e9365660b6b17c2f0ed8 | 4503926bf236283dca87bc241b96bd80da17cd04 | ArdanStudios/aggserver | /log/log_examples_test.go | Go | go | 847 | permissive | package log_test
import (
"errors"
"os"
"testing"
"github.com/ardanstudios/aggserver/log"
)
// ExampleDev shows how to use the log package.
func ExampleDev(t *testing.T) {
// Init the log package for stdout. Hardcode the logging level
// function to use USER level logging.
log.Init(os.Stdout, func() int { ret... |
7533065a77d90e606ffe4e821557234a6bee5939 | 67a5fc8302ecb6870bcadadb9c1ea29789f80ccc | greenszpila/infrastructure-agent | /internal/instrumentation/noop_test.go | Go | go | 858 | permissive | // Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package instrumentation
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewNoopServer(t *testing.T) {
server... |
3321cd80f4facadd4a258b5f352f4130b3d97509 | c13ff88f3fdf6719e109d729d3852fcfdaa177a0 | aylei/tidb | /owner/mock.go | Go | go | 2,357 | permissive | // Copyright 2017 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... |
7dec9624ff64329e3f9c58f5f98e233922b9ea7c | b448988e71591110ee611f95d9e2de261436a5bd | AaronWashington/digitalocean-cloud-controller-manager | /vendor/github.com/minio/minio-go/api.go | Go | go | 26,795 | permissive | /*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
* Copyright 2015-2018 Minio, 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/L... |
a8fe1c8cc7fdd1b452a8dfe13ba1c4a8488d736b | a6c1ec01d84c4ce1af03bff955c89dfef5eb1b53 | olafz/datadog-agent | /pkg/ebpf/offsetguess.go | Go | go | 12,830 | permissive | // +build linux_bpf
package ebpf
import (
"encoding/binary"
"fmt"
"math/rand"
"net"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"time"
"unsafe"
"github.com/iovisor/gobpf/elf"
)
/*
#include "c/tracer-ebpf.h"
*/
import "C"
type tracerStatus C.tracer_status_t
const (
// When reading ke... |
9a1c7781dc4436fdf03f5e1c40bbac09508b68bd | fd2b1a84ffc8ebaf55521feb88a60d1a50063944 | gzltommy/resk-individual | /core/envelopes/po_item.go | Go | go | 2,099 | no_license | package envelopes
import (
"database/sql"
"github.com/shopspring/decimal"
"time"
"gzl-tommy/resk-individual/services"
)
type RedEnvelopeItem struct {
Id int64 `db:"id,omitempty"` //自增ID
ItemNo string `db:"item_no,uni"` //红包订单详情编号
EnvelopeNo string ... |
ff65e3f4c5925fd93bcfefc62582ad8e9ea5f96c | 198e525a30ccb1e404c9e2aec80afe1ff0bde48e | lomy/leetcode | /solution/1-99/0036.valid-sudoku/solution.go | Go | go | 575 | permissive | package leetcode
/*
* @lc app=leetcode.cn id=36 lang=golang
*
* [36] 有效的数独
*/
// @lc code=start
func isValidSudoku(board [][]byte) bool {
// ascii 1-9 = 48-57
var row, col, block [9][58]bool
for k, nums := range board {
for i, v := range nums {
if v == '.' {
continue
}
if row[i]... |
b58c49bfd6ae3f169937b0a527f8a6bcae951cbe | 0fe859b75a3fdd1e69b78e06973628246841991c | return0o0/qkteam-api | /controller/response.go | Go | go | 693 | no_license | package controller
import (
"github.com/gin-gonic/gin"
"net/http"
)
type ResponseData struct {
Code ResCode `json:"code"`
Msg interface{} `json:"msg"`
Data interface{} `json:"data"`
}
func ResponseSuccess(c *gin.Context, data interface{}) {
rd := &ResponseData{
Code: CodeSuccess,
Msg: CodeSuccess.Msg... |
77271223ab9995de21241ce8f1c769c53c32a7c3 | 5e4ef694a372305801bb0a8a7d952cb6a60512ca | sunejax/abs | /addToCart/src/apis/rest/router.go | Go | go | 497 | no_license | package rest
import (
"fmt"
"github.com/labstack/echo"
"net/http"
"repo.abs.com/hiring/addToCart/src/apis/rest/store"
"repo.abs.com/hiring/addToCart/src/config"
)
// BuildRouter ...
func BuildRouter() {
// Initialises internal server
router := echo.New()
router.GET("/ping", checkPing)
store.Routes(router)
... |
51a1753a873dc5c051018e2e093e45c65af4ac72 | 778abb50c7ead45b3e785a8cea145d6c8efe9b84 | nh-live/goformula | /easylang/error.go | Go | go | 1,727 | no_license | package easylang
import "fmt"
type SyncError interface {
String() string
}
type synxerror struct {
line int
column int
}
type undefinedVarError struct {
synxerror
varName string
}
func UndefinedVarError(line, column int, varName string) *undefinedVarError {
return &undefinedVarError{
synxerror: synxerror... |
c66241987b50163dbb82db0c949aa892cc47946e | 4492e92044ca23598b69bb376e347a426254b24a | filecoin-project/venus | /pkg/events/eventAPI.go | Go | go | 1,274 | permissive | package events
import (
"context"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/venus/venus-shared/types"
)
// A TipSetObserver receives notifications of tipsets
type TipSetObserver interface {
Apply(ctx context.... |
a7e6ae34862f7d558f29cfe1a4b98f5ed46b5941 | 3b35ed608f8c30cf14f4a6ac74333d7a54d185af | superavengers/eudore | /_example/middlewareLoggerLevel.go | Go | go | 1,154 | permissive | package main
import (
"github.com/eudore/eudore"
"github.com/eudore/eudore/component/httptest"
"github.com/eudore/eudore/middleware"
)
func main() {
app := eudore.NewApp()
// 设置日志级别Info,使用Options方法加载Logger刷新pinrt函数使用的日志级别
app.SetLevel(eudore.LogInfo)
app.Options(app.Logger)
app.AddMiddleware(func(ctx eudore.... |
20a6cc7b193ac03c74e394c122930f4a7e3f45ed | 0242a652d241abd0dbf543283bea85ec9318934d | zhangf911/wag | /mach_amd64.go | Go | go | 416 | permissive | // Copyright (c) 2016 Timo Savola. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wag
import (
"github.com/tsavola/wag/internal/x86"
)
const (
machNative = x86.Native
machFunctionAlignment = x86.FunctionAlignment
mac... |
5dd25938fd2020be6d7b3211eb2662aa0b54393e | 4f46517f79e6c1af766addd74d6bd904492a6d41 | kokizzu/lxd | /lxd/operations/websocket.go | Go | go | 1,564 | permissive | package operations
import (
"fmt"
"net/http"
"github.com/gorilla/websocket"
"github.com/lxc/lxd/lxd/response"
"github.com/lxc/lxd/shared/ws"
)
type operationWebSocket struct {
req *http.Request
op *Operation
}
// OperationWebSocket returns a new websocket operation.
func OperationWebSocket(req *http.Reques... |
9883c6472884116d36cd3cd589debeec7598c960 | 0e3d8c1f1120896f214e6a533f9b769f34837cec | ozanturhan/golang_learning | /021_functions/example_1.go | Go | go | 414 | no_license | package main
import "fmt"
func main() {
name := "Ozan"
sayHello(name)
println(name)
namePointer := "Ozan"
sayHelloWithPointer(&namePointer)
println(namePointer)
fmt.Println(add(3, 4, ""))
}
func sayHello(name string) {
println("Hello", name)
name = "Zeynep"
}
func sayHelloWithPointer(name *string) {
pr... |
478f57b17d37cb67e931229f1780353789f871f5 | bee9d12264c6d70465103d3119ee09cad55bafcd | isabella232/azure-service-operator | /pkg/secrets/kube/client.go | Go | go | 3,348 | permissive | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package kube
import (
"context"
"fmt"
"github.com/Azure/azure-service-operator/pkg/secrets"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/clien... |
a7f10a8f8f3f9c7a40f28675713170e22c273605 | 61edc989d340211d08289f100b0744ef11d8eb02 | amosir/tcache | /lru/lru.go | Go | go | 2,292 | no_license | package lru
import "container/list"
// 缓存值类型
type Value interface {
// 获取占用的字节数
Len() int
}
// 注意在缓存中最近访问的元素在链表头,待清除的元素在链表尾
type Cache struct {
// 缓存最大能使用的内存, 为0表示无限制
limitedBytes int64
// 已经使用的内存
usedBytes int64
// 存放缓存元素的双向链表
ll *list.List
// 哈希表
cache map[string]*list.Element
// 移除元素时的回调函数,可以为空
OnEvic... |
7b58d92e8a75f53f2e8ee172f0c66d8656c5e98b | 61a92efc0f24e1bb9d26372d2bc7c6f286b23fa7 | BestKind/leetcode | /go/14_longest_common_prefix_test.go | Go | go | 1,806 | no_license | package main
import (
"fmt"
"testing"
"time"
)
/**
* 编写一个函数来查找字符串数组中的最长公共前缀
* 如果不存在公共前缀,返回空字符串 ""
* 示例 1:
* 输入: ["flower","flow","flight"]
* 输出: "fl"
* 示例 2:
* 输入: ["dog","racecar","car"]
* 输出: ""
* 解释: 输入不存在公共前缀。
* 说明:
* 所有输入只包含小写字母 a-z
* 方法二 优于 方法一
*/
/** 方法一 */
func longestCommonPrefix(strs ... |
a1d7c4926c8cc12043831490fb95e46f421e9184 | 48cfd555e4a92824d337a44df5bacd90bef90a03 | just331/gotraining | /14_functions/11_closure/05/main.go | Go | go | 341 | no_license | package main
import "fmt"
func wrapper() func() int {
var x int
return func() int {
x++
return x
}
}
func main() {
incrementA := wrapper()
incrementB := wrapper()
fmt.Println("A:", incrementA())
fmt.Println("A:", incrementA())
fmt.Println("B:", incrementB())
fmt.Println("B:", incrementB())
fmt.Println(... |
075251a3c9bcba65a6ff9e96344007bd19f27e58 | 14fe55d92af68c931d97d5275d065e8cb8894e70 | ezynda3/go-loom | /client/plasma_cash/block.go | Go | go | 1,117 | permissive | // +build evm
package plasma_cash
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
pctypes "github.com/loomnetwork/go-loom/builtin/types/plasma_cash"
)
// Plasma Block
type PbBlock struct {
block *pctypes.PlasmaBlock
}
func NewClientBlock(pb *pctypes.PlasmaBlock) Block {
return &PbBlock{pb}... |
2c036f9f115f1c280de7ba1cb1cacea65b889071 | 759ff8b23a17a3d7187cb7c0d00a6d889eeceeac | ManchersterByTheSea/openBilibili | /go-common/app/interface/main/kvo/http/http.go | Go | go | 1,115 | no_license | package http
import (
"net/http"
"go-common/app/interface/main/kvo/conf"
"go-common/app/interface/main/kvo/service"
"go-common/library/log"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/http/blademaster/middleware/auth"
)
var (
kvoSvr *service.Service
authSvr *auth.Auth
)
// Init init ... |
f5223c6a8aef789b410aad7d49336f0f64c69725 | 7614878574f3c8719fd9ffe6ba18d6ba1bec9382 | eikoshelev/etcd-proxy-server | /internal/proxy/proxy.go | Go | go | 814 | no_license | package proxy
import (
"net/http"
"github.com/eikoshelev/etcd-proxy-server/internal/client"
"go.uber.org/zap"
)
type Proxy struct {
Client *client.Client
Logger *zap.Logger
}
func Setup(client *client.Client, logger *zap.Logger) *Proxy {
return &Proxy{
Client: client,
Logger: logger,
}
}
func (p *Proxy)... |
b028c15189739ab7f8f133e6453816abb04971bb | 01ef3cdd7ddae0dbaf28779478896a6424c652c2 | SSvilen/k8s-bigip-ctlr | /pkg/resource/types.go | Go | go | 17,817 | permissive | /*-
* Copyright (c) 2016-2021, F5 Networks, 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 l... |
3495a7a689920d8b34ce01be9dd3d024401c53c0 | ab3e0f3d73613da04cf13658838990fc54e10d74 | PithomLabs/zepto | /web/context.go | Go | go | 2,827 | permissive | package web
import (
"context"
"encoding/json"
"github.com/go-zepto/zepto/broker"
"github.com/go-zepto/zepto/logger"
"github.com/go-zepto/zepto/web/renderer"
"github.com/gorilla/mux"
"net/http"
"sync"
// Enable webpack asset feature
_ "github.com/go-webpack/pongo2"
)
type Context interface {
context.Contex... |
308a077ebed83cb72f088261e52634b6b831f0b5 | 1198aa2a67c23c2f1e2915db5d07f70738dc2ede | developerfred/bridge-eth | /uniswaptrading_test.go | Go | go | 17,897 | no_license | package main
import (
"fmt"
"math/big"
"strings"
"testing"
"time"
"github.com/incognitochain/bridge-eth/bridge/uniswap"
"github.com/incognitochain/bridge-eth/bridge/vault"
"github.com/stretchr/testify/suite"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"... |
70b04e858a71adc3c31658e26d54cd0386a2637b | 817a69cb274fa117fef4e9c7a462d1f5150b0bdb | wxf4150/zerg | /zerg_client/client.go | Go | go | 2,108 | no_license | package zerg_client
import (
"errors"
"github.com/wxf4150/load_balanced_service"
pb "github.com/wxf4150/zerg/protos"
"golang.org/x/net/context"
"google.golang.org/grpc"
"strings"
"log"
)
type ZergClient struct {
endPoints []string
serviceName string
lbService load_balanced_service.LoadBalancedService
c... |
04cce6f9aabe4a69090617cac6aee4c21cc2d1e6 | 376c2b87036f466d01d09fcf824e193b8f9324f1 | martin-helmich/go-powerdns | /apis/zones/zones_removerecordset.go | Go | go | 511 | permissive | package zones
import (
"context"
"fmt"
"net/url"
)
func (c *client) RemoveRecordSetFromZone(ctx context.Context, serverID string, zoneID string, name string, recordType string) error {
path := fmt.Sprintf("/api/v1/servers/%s/zones/%s", url.PathEscape(serverID), url.PathEscape(zoneID))
set := ResourceRecordSet{
... |
47fb06de5a4a404a78cea91d085c442ba7085121 | ae3908fba79c36850512a4280e79e0d61034e6a3 | h3ndrk/osc-to-artnet | /main.go | Go | go | 3,307 | permissive | package main
import (
"fmt"
"log"
"net"
"os"
"os/signal"
"strconv"
"syscall"
"time"
"github.com/hypebeast/go-osc/osc"
"github.com/jsimonetti/go-artnet/packet"
"github.com/pkg/errors"
)
type oscClient struct {
conn *net.UDPConn
}
func newOscClient(addr string) (*oscClient, error) {
c := &oscClient{}
r... |
8c33237af5b353d74f687ae261d915eba6d76161 | c6d34a56a68a20b47511c8ad8a098f6d72374e09 | pranabeshpanda/kubernetes | /pkg/client/client_test.go | Go | go | 16,628 | permissive | /*
Copyright 2014 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 law or agreed to in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.