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 |
|---|---|---|---|---|---|---|---|---|
d529543e71a85e49b7ab1ed5180acc0445c978a4 | ab0a28b9ea4c513003eed8db954795800aa124a6 | ghophp/samodelkin | /revision/revision.go | Go | go | 1,792 | permissive | // Package revision provides a convenience abstraction
// for reading repository file with REVISION information.
//
// REVISION file pattern is a contrained designed for Onefootball CI/CD
// environment in order to keep track of the current app version.
// CD (continious delivery) implies project build and deploy on me... |
ae2e1d474f1fd8d21c484b0da32596fd5e3d50ff | 68660e11d78b8926fb4baddfb34bc3f5e75e7d82 | FrenchBen/infrakit | /pkg/plugin/flavor/swarm/flavor.go | Go | go | 14,051 | permissive | package swarm
import (
"fmt"
"time"
log "github.com/Sirupsen/logrus"
docker_types "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/go-connections/tlsconfig"
"github.com/docker/infrakit/pkg/discovery"
group_types "g... |
fcf1769ffc68c7e613f06c578ef055ca30655827 | 23052d9c1446a37f517a98976dafb9e43c75081b | wangcongyi/go-demo | /src/struct.go | Go | go | 1,152 | no_license | // 由于go语言没有没有class的概念
// 结构struct承担了面向对象的功能
type vertex struct {
x, y int
}
var (
v1 = vertex{1, 2}
v2 = vertex{x:1}
v3 = vertex{}
v4 = &vertex{1, 2}
)
func main() {
fmt.Println(v1) // {1,2}
fmt.Println(v2) // {1,0}
fmt.Println(v3) // {0,0}
fmt.... |
610d5006524dc766eb38e2f1775e3dac091ea582 | 4832025118a7b2633628a814ecdd42edf3d486d1 | oysterpack/oysterpack.go | /pkg/app/app.go | Go | go | 11,126 | permissive | // Copyright (c) 2017 OysterPack, 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 t... |
579bc85bf18b1e77923b3b4d6d89f0dc98a6d925 | e29680f6f3e29453bf8036e4f3a0a07ba13f265e | amazingchow/seaweedfs-tools | /vendor/github.com/chrislusf/seaweedfs/weed/storage/store.go | Go | go | 12,105 | permissive | package storage
import (
"fmt"
"path/filepath"
"strings"
"sync/atomic"
"google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/... |
376d3916124024dec1645cc23b901fa0fb037193 | b0b81eb2ef8417aedcaa9d122e4bf03005987d38 | snailshen2014/research | /go/gwp-master/Chapter_11_Frameworks_Frameworks_Everywhere/ws-goji/post/post.go | Go | go | 1,697 | no_license | package post
import (
"github.com/zenazn/goji/web"
"encoding/json"
"net/http"
"strconv"
)
// Retrieve a post
// GET /post/1
func HandleGet(c web.C, w http.ResponseWriter, r *http.Request) {
id, _ := strconv.Atoi(c.URLParams["id"])
post, err := retrieve(id)
if err != nil {
http.Error(w, "Cannot get post", 40... |
3e0762e0e3663b9d8c2acf0f27cebe1f8936efea | a40398e636f7a1468bfa33c684cfdf8f01768fba | JAX-Network/shard.core | /btcwallet/lightclient/blockntfns/manager_test.go | Go | go | 8,168 | permissive | package blockntfns_test
import (
"errors"
"gitlab.com/jaxnet/core/shard.core.git/wire/chain"
"testing"
"time"
"gitlab.com/jaxnet/core/shard.core.git/btcwallet/lightclient/blockntfns"
)
var emptyHeader chain.BlockHeader
type mockNtfnSource struct {
blockChan chan blockntfns.BlockNtfn
blocksSinceHeight... |
bb99cc07bbb0d6fe7ecc69191e5ee0014a465fc1 | 1d389dca71871671df9f1c4ef6f88ce1d982128a | ferranbt/heura | /helper/hex/hex.go | Go | go | 584 | permissive | package hex
import (
"fmt"
"strings"
"encoding/hex"
)
func EncodeToHex(str []byte) string {
return "0x" + hex.EncodeToString(str)
}
func EncodeToString(str []byte) string {
return hex.EncodeToString(str)
}
func DecodeString(str string) ([]byte, error) {
return hex.DecodeString(str)
}
func DecodeHex(str stri... |
5fb7d590dbe254fb967cfb6ddb8320860bdc0cdc | 9310c5b4303b31f2a2109403748792d140c3ce1c | objectrocket/karma | /cmd/karma/proxy_test.go | Go | go | 30,517 | permissive | package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"regexp"
"strings"
"testing"
"time"
cache "github.com/patrickmn/go-cache"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/mock"
log "github.... |
9e2450e6a95a96a35cad7720f4314a4ac1f66678 | 12a6e4e7fe8ee51ef357d074db52c6c66d586ff1 | ExpediaDotCom/haystack-client-go | /logger.go | Go | go | 1,203 | permissive | /*
* Copyright 2018 Expedia 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 appl... |
5fdd2e1f2f38cf2b8c6d67531e0fe6e2c692f8da | f8a5e489890550353b8d227d022e8b896dfb6b59 | dolzenko/flood | /qfy/rule.go | Go | go | 745 | permissive | package qfy
import "github.com/bsm/intset"
// Rule is an abstract logic evaluation.
type Rule interface {
// UID uniquely identifies the rule
UID() uint64
// Match tests if the rule is qulified
Match(*intset.Set) bool
// String returns a human-readable rule description
String() string
}
// ------------------... |
013290f59d60b51c5a03d63798cdf3745ae2bc14 | d89fef7c6b3c54dd3996dd05e2fddedd748116de | semaj/golua | /lua/lua_defs_lua53.go | Go | go | 2,109 | permissive | //+build lua53
package lua
/*
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
*/
import "C"
type LuaValType int
const (
LUA_TNIL = LuaValType(C.LUA_TNIL)
LUA_TNUMBER = LuaValType(C.LUA_TNUMBER)
LUA_TBOOLEAN = LuaValType(C.LUA_TBOOLEAN)
LUA_TSTRING = LuaValType(C.LUA_TS... |
0b8540fec382b9a24f0657378a78b31d093a214f | d766c150b4221de1d896fba37e124f8cacd2ac4c | mongodb/anser | /mock/processor.go | Go | go | 751 | permissive | package mock
import (
"github.com/mongodb/anser/client"
"github.com/mongodb/anser/model"
)
type Processor struct {
NS model.Namespace
Query map[string]interface{}
Cursor client.Cursor
MigrateError error
LastMigrateCallMismatch bool
NumMigrateC... |
86595247121d546bc5e364323c13371a5773fed9 | 313e2c5c0babea427a58bffd87c809ba9212b6ab | ArnoBuschmann/scaleway-cli | /internal/namespaces/k8s/v1/k8s_cli.go | Go | go | 53,479 | permissive | // This file was automatically generated. DO NOT EDIT.
// If you have any remark or suggestion do not hesitate to open an issue.
package k8s
import (
"context"
"reflect"
"github.com/scaleway/scaleway-cli/internal/core"
"github.com/scaleway/scaleway-sdk-go/api/k8s/v1"
"github.com/scaleway/scaleway-sdk-go/scw"
)
... |
e0503267cd06979823eefc8b37f138f129495a80 | 97fbaa2ce65f6dbbb8027a3863113bf19c1cc7d5 | mfrw/parlimit | /parlimit.go | Go | go | 720 | no_license | // Package parlimit limits concurecy of goroutines, by creating
// a buffered channel with the desired concurency limit.
// Any goroutine that starts off, sends an empty struct to the
// channel, if the channel is full, the send blocks.
package palrimit
type limiter chan struct{}
// NewLimiter returns a new limiter ... |
4c7b05e2475317d8cca15d0dc72042a54c4d7ce1 | 47f832f9eb8dfb6c71dd3132142bc129799d3409 | c3sr/openwhisk-go | /swagger_models/action.go | Go | go | 4,338 | permissive | package swagger_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
// Action acti... |
d2ebbfece009d27cdefa20c436a0aea25da2c919 | 739e007c74da71a09de9ef3b6184677b35d7a352 | tiraboschi/kubevirt | /tests/storage/datavolume.go | Go | go | 45,522 | permissive | /*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
42f06903de71fa4fb438195944853e52371868d3 | 2255e04ee069284f85b26d0a4d490ef1c53eb83b | TheJaySmith-Google/pulumi-google-native | /sdk/go/google/pubsub/v1beta1a/getTopic.go | Go | go | 888 | 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 v1beta1a
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Gets the configuration of a topic. Since the topic only has the name attribute, this m... |
9b0e2ad2479ef83c217ec962b17b2b025ef45ff3 | dcaed56b9c996eb5e99abdd9bb335588b5b9141e | dendi875/go-study | /ch4/my_slice2/main.go | Go | go | 636 | no_license | package main
import "fmt"
func main() {
months := [...]string{1: "一月", 2: "二月", 3: "三月", 4: "四月", 5: "五月", 6: "六月", 7: "七月", 8: "八月", 9: "九月", 10: "十月", 11: "十一月", 12: "十二月"}
Q2 := months[4:7]
summer := months[6:9]
fmt.Printf("len(Q2) = %d, cap(Q2) = %d\n", len(Q2), cap(Q2))
fmt.Printf("len(summer) = %d, cap(s... |
cca40c5c16143709dcdac87a30d9aa9b4c6db5c1 | 0623c5d643f2b893d214607d91a0896b82cdf020 | ihakkitekin/benchmarks | /apps/string-operations/go/std/main.go | Go | go | 1,809 | permissive | package main
import (
"flag"
"fmt"
"net/http"
"regexp"
"strings"
"time"
)
const STATIC_STRING = "0 12 -5 123 -18 5 -6 1 -1234 lorem 423 -ipsum";
const STATIC_STRING_TIME = "Current time $time";
var STATIC_REGEXP = regexp.MustCompile("-[1-9]\\d*");
var STATIC_REGEXP_TIME = regexp.MustCompile("\\$time");
func ma... |
db212d9fbf71b336d4f605edded9aea7b2420f27 | ed67395c2e096762ccadd31850bd5a647afff0b5 | pierangelo1982/goLangCorso | /19_map/14_hash-table/03_words-in-buckets/02_map-bucket/main.go | Go | go | 1,084 | no_license | package main
import (
"bufio"
"fmt"
"log"
"net/http"
)
func main() {
// get the book adventures of sherlock holmes
res, err := http.Get("http://www.gutenberg.org/cache/epub/1661/pg1661.txt")
if err != nil {
log.Fatal(err)
}
// scan the page
scanner := bufio.NewScanner(res.Body)
defer res.Body.Close()
//... |
d1fa7552df749a5368ceaded90c46e64e2be9ad0 | 842b0827dfcb3916374e78195fa827ded4eec511 | YoonBaek/learngo | /10EncapsuleAndEmbbedding/06Practices/practices.go | Go | go | 810 | no_license | // Solved by Github YoonBaek
package main
import (
"fmt"
"log"
"github.com/YoonBaek/learngo/10EncapsuleAndEmbbedding/06Practices/geo2"
)
func main() {
// practice1
coordinates := geo2.Coordinates{}
err := coordinates.SetLatitude(37.42)
if err != nil {
log.Fatal(err)
}
err = coordinates.SetLongitude(-112... |
16c943a37472f290ea982286b4f280268b15e7ed | ce152e8f44646eeb8cb61f26f0d2d62418b6891d | willshang/go-leetcode | /source/0101-0200/0137_single-number-ii/2-排序遍历.go | Go | go | 280 | no_license | package main
import (
"fmt"
"sort"
)
func main() {
fmt.Println(singleNumber([]int{2, 2, 3, 2}))
}
func singleNumber(nums []int) int {
sort.Ints(nums)
for i := 0; i < len(nums)-1; i = i + 3 {
if nums[i] != nums[i+1] {
return nums[i]
}
}
return nums[len(nums)-1]
}
|
d62cca9f610ae45d88015a6998e8e86aee338d60 | 1a30a8c0674ac7e36e50de7ec33ace1c38447dcc | NastyAir/NastyAirBlogApi | /Utils/CustomRespose.go | Go | go | 713 | no_license | package Utils
import (
"net/http"
"encoding/json"
"html/template"
"fmt"
)
func JsonResponse(response interface{}, w http.ResponseWriter) {
json, err := json.Marshal(response)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusOK)
w.Header().Set(... |
2d295bd15fa959cfc16033002189ade1ab7fc399 | 8eaab27557ca8f7446c22d6e879474dad6c9f758 | marksauter/graphql-go | /internal/common/lexer.go | Go | go | 5,697 | permissive | package common
import (
"fmt"
"strconv"
"strings"
"text/scanner"
"github.com/marksauter/graphql-go/errors"
)
type syntaxError string
type Lexer struct {
sc *scanner.Scanner
next rune
descComment string
useStringDescriptions bool
}
type Ident struct {
Name str... |
7a803b14c2bc78aa4bb5114330c6eb0939386b54 | 62e05564f9a1c8692f7f06dd25892d7f8cf09491 | ademers/nitro | /internal/nitrod/nitro_service_test.go | Go | go | 775 | permissive | package nitrod
// spyChainRunner is used for services that run multiple
// Run commands such as editing an ini file and then
// restarting the php-fpm service after completion
type spyChainRunner struct {
Commands []string
Args []map[string][]string
Output string
}
func (r *spyChainRunner) Run(command string... |
36946fa31812a3222522e7ca01f24e1f962acd39 | 0d9b467ed68a87101be671bb297ed2fde174e741 | qxdes/yagpdb | /automod/automod_bot.go | Go | go | 15,022 | permissive | package automod
import (
"context"
"encoding/json"
"errors"
"sort"
"github.com/jonas747/discordgo"
"github.com/jonas747/dstate"
"github.com/jonas747/yagpdb/automod/models"
"github.com/jonas747/yagpdb/bot"
"github.com/jonas747/yagpdb/bot/eventsystem"
"github.com/jonas747/yagpdb/commands"
"github.com/jonas74... |
facd6d09f107d07b35262b5efad4abefe84accbc | d3e1e245a4f7d448b3e2750b9e9bfea27bf346f8 | wp-jackliu/opentaobao | /model/omniorder/TaobaoOmniitemItemImageUploadResult.go | Go | go | 375 | permissive | package omniorder
// TaobaoOmniitemItemImageUploadResult 结构体
type TaobaoOmniitemItemImageUploadResult struct {
// 错误码,0表示成功
Code string `json:"code,omitempty" xml:"code,omitempty"`
// 错误信息
Message string `json:"message,omitempty" xml:"message,omitempty"`
// data
Data *ItemImageUploadResult `json:"data,omitempty"... |
584d9b2efadaceca908c6d05caa735f0e304be50 | 3ba11ebca72f5e705e44809d1553a04494f46b3d | Spacefish/products | /bobby/domain/transactions/bodies/containers/databases/saves/transaction.go | Go | go | 1,481 | permissive | package saves
import (
"github.com/steve-care-software/products/bobby/domain/selectors"
"github.com/steve-care-software/products/libs/hash"
)
type transaction struct {
hash hash.Hash
graphbase selectors.Selector
name string
database selectors.Selector
}
func createTransaction(
hash hash.Hash,
grap... |
950c2161ccfbb6b9be259abe465cd8b3d1e28b09 | e984485be7139dd00d160ab96b4cbaab954fa8d8 | sacloud/libsacloud | /v2/helper/service/mobilegateway/logs_request.go | Go | go | 944 | permissive | // Copyright 2016-2022 The Libsacloud 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... |
ad3b04b92c88e6e2a7e355c2fb701e96a539c56b | 901974f107e1f34e7c620baaf6481d2b776baa3b | noknow-hub/go_localizedStrings | /localizedStrings.go | Go | go | 3,741 | no_license | //////////////////////////////////////////////////////////////////////
// localizedStrings.go
//
// @usage
//
// 1. Set json files you want to load.
//
// jsonFiles := map[string]string{
// "en": "/your_json_path/en.json",
// "ja": "/your_json_path/ja.json",
// }
//
// 2. Initialize.
//
//... |
973088e264d4c480f5b126dcbff9bcf13f58aa73 | 385a64495a0801174ca0fe35c25b9bf23876bd5f | as-polyakov/opentelemetry-collector-contrib | /cmd/otelcontribcol/components.go | Go | go | 7,023 | permissive | // Copyright 2019 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... |
378a7e3f07e977e433bf0cead473876f0ca58950 | f20316a9d719c6c1de9dfdca02c860e3bda13448 | ajulthomas/golang-gin-poc | /controllers/video-controller.go | Go | go | 639 | no_license | package controller
import (
"github.com/ajulthomas/golang-gin-poc/entity"
"github.com/ajulthomas/golang-gin-poc/service"
"github.com/gin-gonic/gin"
)
type VideoController interface {
FindAll() []entity.Video
Save(ctx *gin.Context) entity.Video
}
type controller struct {
service service.VideoService
}
func New... |
f4455a897c6d80c90ae0e418a733b66bcee06083 | 9e73bb8c5cfa0794ee28cb9b36065e910fff7d6f | kubernetes/kubernetes | /test/e2e_node/memory_manager_test.go | Go | go | 23,072 | permissive | //go:build linux
// +build linux
/*
Copyright 2017 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 applic... |
45c90ca73d192321487704c4f864a6100b1a87f4 | b0dcdd47350b1d04a791dea284c3f69f0a383747 | roncohen/apm-server | /vendor/github.com/elastic/beats/libbeat/monitoring/report/elasticsearch/elasticsearch.go | Go | go | 6,057 | permissive | package elasticsearch
import (
"errors"
"io"
"math/rand"
"net/url"
"strings"
"time"
"github.com/elastic/beats/libbeat/beat"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/monitoring"
"github.com/elastic/beats/libbeat/monitoring/report"
"... |
e9f5fe018240cb9225cc09eb3a12f2ab51f43082 | 72936bd97b2d789302aa7469820b59959c9d990c | jlauinger-mscthesis/tilt | /internal/engine/subscribers.go | Go | go | 1,818 | permissive | package engine
import (
"github.com/tilt-dev/tilt/internal/cloud"
"github.com/tilt-dev/tilt/internal/containerupdate"
"github.com/tilt-dev/tilt/internal/engine/analytics"
"github.com/tilt-dev/tilt/internal/engine/configs"
"github.com/tilt-dev/tilt/internal/engine/dcwatch"
"github.com/tilt-dev/tilt/internal/engin... |
e7aca3b60e22c26a391ad591c43eb32d96e3b66d | 793f584eb09b9d58d8b78416de808daf7361cae9 | Rightech/ric-edge | /vendor/github.com/gopcua/opcua/ua/typereg.go | Go | go | 1,891 | permissive | // Copyright 2018-2020 opcua 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 ua
import (
"reflect"
"sync"
"github.com/gopcua/opcua/errors"
)
// TypeRegistry provides a registry for Go types.
//
// Each type is registere... |
e6b5d5787c01a2cc4a95c46913c2aeacb9a3b5b9 | b59d08b8d79c15e31716384db922e480a61fdaec | opencord/opendevice-manager | /pkg/models/device/db_test.go | Go | go | 10,907 | no_license | /*
* Copyright 2020-present Open Networking Foundation
*
* 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... |
79766ebb8ef01af672cac8dc530412ce82c36aca | e90b942b278f6c783ac47751948631b6a96eacdf | CxZMoE/neteasemusic-cli | /ncmd_linux.go | Go | go | 2,977 | permissive | // +build linux
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"syscall"
"time"
"github.com/CxZMoE/NetEase-CMD/account"
"github.com/CxZMoE/NetEase-CMD/control"
"github.com/CxZMoE/NetEase-CMD/interact"
"github.com/CxZMoE/NetEase-CMD/logger"
"github.com/CxZMoE/NetEase-CMD/network"
)
var me acco... |
8130ea4f86f3ba2dee0cfd7ae058cb55d7120bb5 | 1e0a088e8e36a954126b04e17b0805b8f378a17b | erlangs/hexya | /src/views/views.go | Go | go | 16,038 | permissive | // Copyright 2016 NDP Systèmes. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
f37c53a522cc09296071f01bdf2428a87d64f049 | c1f68cf1cfd0d88a98ff2263c4a4075c137451f3 | kalokng/leetcode | /ans/longest-palindromic-substring/main.go | Go | go | 999 | no_license | package main
import "fmt"
func main() {
for _, s := range []string{
"babad",
"x",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"aaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaa",
"aaaaaaaaaaaaaaaaaaaaaaabaaa... |
73098bba2cc99b073db33e7f80ed211dc74aa4d0 | ab741a39cf530c1c48dd095a5f89d6fec4033164 | htdvisser/exp | /backbone/server/cookie/cookie.go | Go | go | 2,412 | permissive | // Package cookie provides middleware for working with device, session and user session cookies.
package cookie
import (
"fmt"
"net/http"
"github.com/benbjohnson/clock"
"github.com/segmentio/ksuid"
"htdvisser.dev/exp/backbone/server"
)
// Option is an option for the cookie middleware.
type Option interface {
a... |
b1451eb161746c0ac2d588856f19870e710ba547 | 9160893e98c59bfa84838035be873270405ce441 | ruheni/sandbox | /gowebapp/main.go | Go | go | 225 | no_license | package main
import(
"fmt"
"net/http"
)
func main(){
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){
fmt.Fprintf(w, "Hello, you've requested: %s\n", r.URL.Path)
})
http.ListenAndServe(":80", nil)
} |
0a3334ee86c69ae27c777537c98898c56be5e3aa | 9523944a0cfb3c0926c6779f7e0f734714022232 | chrismellard/jx-secret | /pkg/schemas/helpers_test.go | Go | go | 1,404 | permissive | package schemas_test
import (
"path/filepath"
"testing"
"github.com/jenkins-x/jx-secret/pkg/schemas"
"github.com/jenkins-x/jx-secret/pkg/schemas/testschemas"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLoadSurveySchema(t *testing.T) {
fileName := filepath.Join("test_d... |
68b78e3afee92ebb6959d8ba5b92b5f7cdc61a49 | 419bac091176549bebd425df3b0167c3dd3fd241 | takaaki12353491/scheduler | /api/schedule/app/module/connection.go | Go | go | 1,001 | no_license | package module
import (
"os"
"strings"
log "github.com/sirupsen/logrus"
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
type (
Connection struct {
DBMS string
User string
Pass string
Host string
Port string
DBName string
Option string
}
Option func(*Connection)
)
func WithDBName(dbName strin... |
f7e58afc9c234881ee8b43234ab9f86a69dfe8ce | 043c1e310b2e1e169c6fff62b6258544163b4d02 | gopheracademy/gopheracademy-web | /content/advent-2019/cmdline/progress.go | Go | go | 246 | permissive | package main
import (
"flag"
"time"
"github.com/cheggaaa/pb/v3"
)
func main() {
flag.Parse()
count := 100
bar := pb.StartNew(count)
for i := 0; i < count; i++ {
time.Sleep(100 * time.Millisecond)
bar.Increment()
}
bar.Finish()
}
|
f7d00c01749e23c6c1980b798a3907a9d23d7388 | 39c8c3f2ed52eae0cb9ccc817298dc1b075d7acf | summerKK/go-code-snippet-library | /blog-service/internal/middleware/jwt.go | Go | go | 918 | permissive | package middleware
import (
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"github.com/summerKK/go-code-snippet-library/blog-service/pkg/app"
"github.com/summerKK/go-code-snippet-library/blog-service/pkg/errcode"
)
func JWT() gin.HandlerFunc {
return func(c *gin.Context) {
var (
token string
ec... |
49fc49f97e741cbd50f939398b2346e40e589ed1 | 269fcba34f09989b14d4456534de9a6e3af9d05f | treetopllc/go-sqlmock | /expectations.go | Go | go | 1,962 | permissive | package sqlmock
import (
"database/sql/driver"
"reflect"
"regexp"
)
// an expectation interface
type expectation interface {
fulfilled() bool
setError(err error)
}
// common expectation struct
// satisfies the expectation interface
type commonExpectation struct {
triggered bool
err error
}
func (e *com... |
2cf50fa123f2a5cb28e0a05c25d22a93361a1b3f | 0d873bb06e4c5b86122a29065f63f072e472bb7f | maxandersen/goa | /goagen/gen_app/generator.go | Go | go | 11,550 | permissive | package genapp
import (
"flag"
"fmt"
"os"
"path/filepath"
"sort"
"github.com/goadesign/goa/design"
"github.com/goadesign/goa/goagen/codegen"
"github.com/goadesign/goa/goagen/utils"
)
// Generator is the application code generator.
type Generator struct {
outDir string // Path to output directory
target... |
c8656f1b00c61a3c033691a634ae89be8e9731f5 | 884bb6f26d8e327174594112067b563596e3115d | XR0118/logkit | /sender/fault_tolerant.go | Go | go | 16,948 | permissive | package sender
import (
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
"sync"
"sync/atomic"
"time"
"github.com/json-iterator/go"
"github.com/qiniu/log"
"github.com/qiniu/pandora-go-sdk/base/reqerr"
"github.com/qiniu/logkit/conf"
"github.com/qiniu/logkit/queue"
. "github.com/qiniu/logkit/utils/models"
... |
8cb5c9a0668af9a68237f0b1c2ffa978b5ad3f3b | 3e67b76955019e8088f5edd7cfe478d14fb37ae5 | davidraskin/istio | /tests/integration/security/webhook/webhook_test.go | Go | go | 4,150 | 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... |
8c0439c6809e0a4111fb20786326486ab365f293 | c638b9b1d506058dcb9475e49534a80025cb8e33 | neezhe/NSQ-SourceCodeRead | /apps/nsq_stat/nsq_stat.go | Go | go | 4,966 | permissive | // This is a utility application that polls /stats for all the producers
// of the specified topic/channel and displays aggregate stats
package main
import (
"errors"
"flag"
"fmt"
"log"
"os"
"os/signal"
"strconv"
"strings"
"syscall"
"time"
"nsq/internal/app"
"nsq/internal/clusterinfo"
"nsq/internal/http... |
6ef53f207afa8fef106f89632ca4830ea9f67257 | 86ff65fddf63cedbb5d104eb931ba63d56fe5bdc | athiwatp/aws-node-termination-handler | /pkg/drainevent/scheduled-event_internal_test.go | Go | go | 1,041 | permissive | // Copyright 2016-2017 Amazon.com, Inc. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "lic... |
8d045f46eea4b584cb93cd86ab90fbf0f221edbd | 8b6bf36001fe9cee4a31a536d4e8ecf3b84b9799 | matrixorigin/matrixone | /cmd/mo-service/debug.go | Go | go | 9,472 | permissive | // Copyright 2021 Matrix Origin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
5bbc250f033b74897285e2d03b609d366be40095 | db9d3cc615c63b89ad9d94be1fa078e2488d7c37 | jackielii/bingo | /langserver/internal/cache/project.go | Go | go | 11,608 | permissive | package cache
import (
"context"
"fmt"
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"sync"
"time"
"github.com/saibing/bingo/langserver/internal/source"
"github.com/saibing/bingo/langserver/internal/util"
lsp "github.com/sourcegraph/go-lsp"
"github.com/s... |
b6fe27b91732b43cb983b137913d337db8cc6f23 | 81cc55fc505b6d6115c065d78ff4b29328256be1 | chr4/go-stellar-sdk | /services/horizon/internal/actions_order_book.go | Go | go | 2,502 | permissive | package horizon
import (
"net/http"
"github.com/stellar/go/services/horizon/internal/db2/core"
"github.com/stellar/go/services/horizon/internal/resourceadapter"
"github.com/stellar/go/support/render/problem"
"github.com/stellar/go/xdr"
"github.com/stellar/go/protocols/horizon"
"github.com/stellar/go/services/h... |
b38863505b0818ec28b142bbc07aaec19e479ba2 | 713700f1fed32d1b097ebc113abbc32a16008378 | robinxiong/ems | /site/config/utils/utils.go | Go | go | 224 | no_license | package utils
import (
"net/http"
"ems/l10n"
)
func GetCurrentLocale(req *http.Request) string {
locale := l10n.Global
if cookie, err := req.Cookie("locale"); err == nil {
locale = cookie.Value
}
return locale
}
|
9bfb7cbbe9f1f33f9eb13d6de12b0852f8e9f7e9 | 4fc872c8a117549667a0b0f90f638a709cf76da7 | kitabisa/rabbitmqclient | /topology.go | Go | go | 1,523 | permissive | package rabbitmqclient
import (
"reflect"
"sync"
"time"
)
// Topology contains all declarations needed to define the topology topology in the rabbitmq.
type Topology struct {
topoVal reflect.Value
mutex *sync.RWMutex
// Mutex protects the following fields
// exchange topology
exchangeDeclare []Exchan... |
dd6080efcf344fe3f2725ece281ddc762a88f024 | c0dbfca40d8bd137eba47db3d075705e7bdf69a3 | dxmon/kubermatic | /pkg/provider/cloud/vsphere/provider.go | Go | go | 13,796 | permissive | /*
Copyright 2020 The Kubermatic Kubernetes Platform 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 ... |
dcef42a6640ba615c6e5a41edc598917fc7ec2b7 | 24afc3e9f77dd6041ded646d6866048bdaf73d6d | ibilalkayy/Virtual-workspace | /profile/info.go | Go | go | 2,987 | no_license | package profile
/* Importing libraries */
import (
"fmt"
"os"
"github.com/ibilalkayy/VWS/database"
"github.com/ibilalkayy/VWS/entrance"
)
/* Declaring variables in struct */
type PersonDetails struct {
email, password, gender, language, phone string
}
var pd = PersonDetails{}
type AccountVariables struct {
N... |
f9fd10ff80f4d1998869e303d0c775f19e17c59c | 0fbbdd5e5f52d1db212202981ac4468df2dffce5 | superToolsCollection/superTools-background | /internal/model/spType.go | Go | go | 434 | permissive | package model
/**
* @Author: super
* @Date: 2021-01-22 20:40
* @Description: 类型表
**/
type SpType struct {
TypeID int `gorm:"column:type_id;primary_key" json:"type_id"`
TypeName string `gorm:"column:type_name" json:"type_name"`
DeleteTime int64 `gorm:"column:delete_time" json:"delete_time"`
}
// TableNam... |
b91ff3f2c3c6a6fe2b9c08dfa4c775d3b973deca | 91ef4eca05fe51b207ba598df8fc94fd567209f3 | flyworker/go-swan-provider | /main.go | Go | go | 1,058 | no_license | package main
import (
"github.com/gin-gonic/gin"
cors "github.com/itsjamie/gin-cors"
"github.com/joho/godotenv"
"os"
"swan-miner/common/constants"
"swan-miner/config"
"swan-miner/logs"
"swan-miner/offlineDealAdmin"
"swan-miner/routers/commonRouters"
"time"
)
func main() {
//LoadEnv()
//config.InitConfig()... |
b85e064b788e2f344f926a4aa9ca9d4c89382720 | 00a97b88461abbfdf95369fcf8d7dec9a984c0ef | sunmi-OS/gocore | /utils/codec/hex.go | Go | go | 1,046 | permissive | package codec
import (
"encoding/base32"
"encoding/base64"
"encoding/hex"
)
// Base64Encode 字符串转64进制
func Base64Encode(str string) string {
return base64.StdEncoding.EncodeToString([]byte(str))
}
// Base64Decode 64进制转字符串
func Base64Decode(str string) (string, error) {
sDec, err := base64.StdEncoding.DecodeStrin... |
2006abf9b56cceda309b76d85aff4fee3812c7e2 | 7bfa758e2936862151b5ecba7333dc6a8843a4b2 | lwolf/kubereplay | /vendor/sigs.k8s.io/testing_frameworks/integration/etcd.go | Go | go | 2,894 | permissive | package integration
import (
"io"
"time"
"net/url"
"sigs.k8s.io/testing_frameworks/integration/internal"
)
// Etcd knows how to run an etcd server.
type Etcd struct {
// URL is the address the Etcd should listen on for client connections.
//
// If this is not specified, we default to a random free port on lo... |
42eea73a9df05673853947c67fc1927232e43dec | b39ef9745617a018fe7e6e0ee1aadfc802a86072 | sanyuesiyuewuyue/erda | /apistructs/pipeline_cron.go | Go | go | 2,398 | permissive | // Copyright (c) 2021 Terminus, 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 agree... |
2f836e00f9a4f221ae0dbea09fcd5bdf2655c269 | 8cdab02a6455e079c8f2d2b2f4156b57fbd8d828 | kametic/go-odoo | /hr_job.go | Go | go | 5,083 | permissive | package odoo
import (
"fmt"
)
// HrJob represents hr.job model.
type HrJob struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
CompanyId *Many2One `xmlrpc:"company_id,omptempty"`
CreateDate *Time `xmlrpc:"create_date,omptempty"`
CreateUid ... |
57df481a7f878dcc1c55e209460f36edefcb8699 | a6df61c182ad31f39c780a0dea8270549f2f4512 | kjose/easyapi | /httperrors.go | Go | go | 807 | permissive | // Copyright 2021 Kévin José. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package easyapi
import (
"fmt"
"github.com/gin-gonic/gin"
)
type httpError struct {
Code int `json:"code"`
Message string `json:"message"`
... |
62320f111dd3ba9382ea3ba50784d31d793ecfba | 3d3b67664b16d3547e5db7b2fb6e193692f276c4 | justmiles/ecs-deploy | /src/cmd/rollback.go | Go | go | 539 | permissive | package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(rollbackCmd)
rollbackCmd.PersistentFlags().StringP("application", "a", "YOUR NAME", "Author name for copyright attribution")
rollbackCmd.PersistentFlags().IntP("task-definition", "t", 0, "Override the task definition version"... |
9746a92175c84581493127bd713e5a5a45f3731b | 1815ceb05ebaa39cb9060e0afe30d57b4d631391 | luckyfengyong/go-provider-devenv | /pkg/mod/github.com/operator-framework/operator-sdk@v0.10.0/cmd/operator-sdk/main.go | Go | go | 5,480 | permissive | // Copyright 2019 The Operator-SDK 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 ... |
6363febccdda97084545f77b878d75e4ae09539c | a4d39e5894e7a0285449ae79543a26410f2c30b9 | visko-sc/mgodatagen | /datagen/generators/constant_generator.go | Go | go | 1,188 | permissive | package generators
import (
"fmt"
"go.mongodb.org/mongo-driver/bson"
)
// ConstGenerator for creating constant value. Val already contains the bson element
// type and the key in addition of the actual value
type constGenerator struct {
base
strVal []byte
bsonVal []byte
}
func newConstantGenerator(base base, ... |
4811b63e2126493ed28328a36259455229c9f158 | bd4e096f055df522d55a9f70160d741c9d24f247 | mr31337/installer | /pkg/terraform/exec/plugins/vendor/github.com/terraform-providers/terraform-provider-azurerm/azurerm/data_source_virtual_machine.go | Go | go | 1,194 | permissive | package azurerm
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
func dataSourceArmVirtualMachine() *schema.Resource {
return &schema.Resource{
Read: dataSourceArmVirtual... |
e3b879259c8078278b0984deef5b87bc6d0e5de7 | 894847dfea6c3b0657175da9e830b4a1c75b102c | sanntidT19/Heisprosjekt | /updateExternalList.go | Go | go | 912 | no_license | package modules
import (
"fmt"
. "math"
. "time"
)
func Update_external_list(newExternalList chan [][]int, externalList [][]int, currentFloor []int ,currentDir []int, newFloor int, newDir int) {
load := make([]int, driver.ELEVATORS)
for i := 0; i < ELEVATORS; i++ {
if externalList[i][1] == 1 { //if floor not ... |
81a9a9479105f224b00ea54de471cab8f97cf50a | e0a16e10457a798e569b6ec5acd86bc70adea16e | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/api_management_gateway_api_resource.go | Go | go | 4,844 | permissive | package apimanagement
import (
"fmt"
"log"
"net/http"
"time"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/... |
e40a8995449fdd54d07ea565ed5996885ba22273 | 1dfd4c058d935cfb6ee535092f84f61263559310 | idoall/gocryptotrader | /gctscript/modules/gct/gct_test.go | Go | go | 7,209 | permissive | package gct
import (
"errors"
"os"
"reflect"
"testing"
"time"
objects "github.com/d5/tengo/v2"
"github.com/idoall/gocryptotrader/exchanges/asset"
"github.com/idoall/gocryptotrader/gctscript/modules"
"github.com/idoall/gocryptotrader/gctscript/wrappers/validator"
)
var (
exch = &objects.String{
Value: "BT... |
3de1141691b9d05280b61f3e3aff67ba03b28b7a | c1b915dbc18838163a15bb508d5b63b6675db864 | alinetskyi/karma-go | /karma_test.go | Go | go | 14,289 | permissive | package karma
import (
"encoding/json"
"errors"
"fmt"
"os"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFormat_CanFormatEmptyError(t *testing.T) {
test := assert.New(t)
test.EqualError(Format(nil, ""), "")
}
func TestFormat_CanFormatSimpleStringError(t *testing.T) {
test := assert.... |
9f1127b246fe714b5fb29e8780aa768c2e49cae8 | f751f7f1d40b893c49ca29bfd4c3900c27bc409c | jameswei/bfs | /store/main.go | Go | go | 1,297 | no_license | package main
import (
"flag"
log "github.com/golang/glog"
)
var (
configFile string
)
func init() {
flag.StringVar(&configFile, "c", "./store.conf", " set store config file path")
}
func main() {
var (
c *Config
z *Zookeeper
s *Store
err error
)
flag.Parse()
defer log.Flush()
log.Infof("bfs s... |
7c8241c67f235506da188f43b078a54d35ec2f34 | 114c400b790365ec5fa16c01ec5efd00a2c5e1c3 | krsnvss/inventoryMongo | /webHandlers.go | Go | go | 5,405 | no_license | package main
import (
"log"
"net/http"
"sort"
"strings"
"github.com/gin-gonic/gin"
mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// Add new device manually via web-interface
func addDevice(c *gin.Context) {
c.Request.ParseMultipartForm(1000)
for key, value := range c.Request.PostForm {
log.Println(key, v... |
d74c35ffb9d43c2605cb83aa97de4795c2b92927 | e5bbff0dc690f724c93864b62e9309ae142708a1 | stephanerenou/cf-drain-cli | /internal/command/create_drain.go | Go | go | 2,701 | permissive | package command
import (
"fmt"
"log"
"net/url"
"code.cloudfoundry.org/cli/plugin"
flags "github.com/jessevdk/go-flags"
uuid "github.com/nu7hatch/gouuid"
)
// Logger is used for outputting log-cache results and errors
type Logger interface {
Printf(format string, args ...interface{})
Fatalf(format string, arg... |
751fa5fd6b085f7bc12e17c2dc46a6ce8cdb9ee5 | ac6568d7308a1adca0704615c20ee874da2e4311 | naoty/ttodo | /views/table.go | Go | go | 2,345 | permissive | package views
import (
"github.com/gdamore/tcell"
"github.com/naoty/ttodo/todo"
"github.com/rivo/tview"
)
// Table represents a table to list TODOs.
type Table struct {
*tview.Table
todos []todo.Todo
}
// NewTable returns a new Table.
func NewTable() *Table {
table := tview.NewTable().
SetSelectable(true, f... |
5587e6e229aa9ca05de72ed144c643adab57f63e | 05cb4f3018d49ad385b517e4a06cfe91f06bc225 | muka/virhal-auth | /model/response.go | Go | go | 244 | permissive | package model
//ResponseLogin a response login
type ResponseLogin struct {
PublicUser
}
//NewResponseLogin init a ResponseLogin
func NewResponseLogin(user *User) ResponseLogin {
return ResponseLogin{
PublicUser: user.ToPublicUser(),
}
}
|
deff9f6cab30659cf235cc90ed1a6ff2d467cf23 | 47e00838e45610383030d842c4b4227db72a0f70 | jeremyhahn/dragonboat | /internal/settings/soft.go | Go | go | 7,493 | permissive | // Copyright 2017-2019 Lei Ni (nilei81@gmail.com) and other 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... |
5c6156d4efe07886689e0d17e8aabf2ac0af3b76 | 7a9f084816714ec8e22fa80207aaab23c00d6f30 | rilwanfit/tdd-with-go | /pointers/pointers_test.go | Go | go | 229 | no_license | package pointers
import "testing"
func TestWallet(t *testing.T) {
wallet := Wallet{}
wallet.Deposit(Bitcoin(10))
got := wallet.Balance()
want := Bitcoin(20)
if got != want {
t.Errorf("got %s want %s", got, want)
}
}
|
c300d06c70d926900b9e070f5d925bdb8ec37a77 | d79fe55c8dc358032f822a83b47a54f819cb88c3 | wangkai2014/core | /dir_router_test.go | Go | go | 1,006 | permissive | package core
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestDirRouter(t *testing.T) {
App := NewApp()
App.Debug = true
pass := RouteHandlerFunc(func(c *Context) {
// Do nothing, it's an automactic pass!
})
fail := RouteHandlerFunc(func(c *Context) {
t.Fail()
})
App... |
5fd4550175572beb16d51798e0694dd27b323ee8 | 776164c63537b9f198180225a736d62a65333cb2 | viccuad/dendrite | /vendor/src/gopkg.in/macaroon.v2/packet-v1_test.go | Go | go | 2,422 | permissive | package macaroon
import (
"strconv"
"strings"
"unicode"
gc "gopkg.in/check.v1"
)
type packetV1Suite struct{}
var _ = gc.Suite(&packetV1Suite{})
func (*packetV1Suite) TestAppendPacket(c *gc.C) {
data, ok := appendPacketV1(nil, "field", []byte("some data"))
c.Assert(ok, gc.Equals, true)
c.Assert(string(data),... |
0be02a69f927757b5a06d20f896de3ed73e2a720 | 39ca80b58c9e998093aae7cd783e07afb51294a2 | dfh420984/learngo | /day3/exec5.8.4/exec5.8.4.go | Go | go | 317 | no_license | package main
import (
"fmt"
)
func main() {
var money float64 = 100000
var count int = 0
for {
if money > 50000 {
money = money - money * 0.05
} else if (money >= 1000 && money <= 50000) {
money = money - 1000
} else {
break
}
count++
}
fmt.Printf("该人可以经过路口%d次", count)
} |
7548ad2e81cc314d462931441a6015ba48a34500 | 7f22d875b4efe7fe52ecb991debbf9657174a209 | tutumagi/pitaya | /service/util.go | Go | go | 7,772 | permissive | // Copyright (c) TFG Co. All Rights Reserved.
//
// 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... |
ca2ca030ef725e35166ef0b38594dc531c1ed8d4 | 807121ac25ac5898c187192c6178b333ae1e46c0 | shawn-programming/Distributed_System | /logSystem/config/config.go | Go | go | 3,589 | no_license | package config
/*
Copied from https://courses.engr.illinois.edu/cs425/fa2020/assignments.html
The GO Version of
Recommended Solutions (from Student Submissions), From Fall 2019 semester: Go C++ Java Python
*/
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
)
type configParam struct {
IPAddress []strin... |
a1b6754e1af874e931677dccbc2fd9cbeb69964c | d0177407e48394872ba0e0cfd44419458763d4c5 | GoogleCloudPlatform/k8s-config-connector | /pkg/test/resourcefixture/resourcefixture.go | Go | go | 6,693 | permissive | // Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
72f8f6173b31340b7106067f32230589a3197e23 | 2b0e6c19e7ac4b913b450755b1408c5e9a22bb87 | jia-jerry/gardener | /pkg/controllermanager/controller/managedseedset/managedseedset_reconciler.go | Go | go | 6,228 | permissive | // Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
1d9d1716d6c65953bf9bbacb6d9646253c4a906a | 1b7795bfebac6642588f4906e5685dd13fb0db20 | thotf/mayipashu | /parser/parserManager.go | Go | go | 4,325 | no_license | package parser
import (
"fmt"
"mayipashu/conf"
"mayipashu/defs"
"mayipashu/iface"
"time"
)
const (
WAIT = 2
RUNNING = 1
STOP = 0
)
type ParserManager struct {
//任务池从logC中读取要处理的数据
logC chan defs.LogData
//用来结束任务的chan
done chan struct{}
parsers []iface.IParser
//SuspendedParserPID chan int //存... |
a15f48ccda980159e2630e27f20812d423ceafa7 | 553e4c2a43ea0292ce2afbca8fe12d41dc48ebcc | BRO3886/covid-twitter-telegram-bot | /pkg/twitter.go | Go | go | 3,761 | no_license | package pkg
import (
"bufio"
"encoding/json"
"fmt"
"net/http"
"regexp"
"time"
log "github.com/sirupsen/logrus"
)
func UnmarshalData(data []byte) (TweetData, error) {
var r TweetData
err := json.Unmarshal(data, &r)
return r, err
}
func (r *TweetData) marshal() ([]byte, error) {
return json.Marshal(r)
}
t... |
50a423ff421b8a7631a9a6048991d6af9aea80f2 | e0c9e9ae6af16ab14ade107af07863cf53ca05c9 | magnologan/huskyCI | /api/analysis/analysis.go | Go | go | 3,101 | permissive | // Copyright 2018 Globo.com 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 analysis
import (
"time"
apiContext "github.com/globocom/huskyCI/api/context"
"github.com/globocom/huskyCI/api/log"
"github.com/globocom/huskyC... |
33d699a4f7780f414a946b0d343caf384e34eef3 | 928b2e2aee397953e3f1a1f4db3187a4f4f6bc80 | justalittlefun1234/google-api-go-client | /servicecontrol/v1/servicecontrol-gen.go | Go | go | 148,662 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package servicecontrol provides access to the Service Control API.
//
// For product documentation, see: https://cloud.google.com/service-contro... |
fe3e2fce98f6be7f2873554fa486fff25700f9c5 | ab07a5a7785387a37e97fd667a81abbd10ab325b | makeItFuckingSustainable/kubernetes-replicator | /replicate/configmap/configmaps.go | Go | go | 8,786 | permissive | package configmap
import (
"encoding/json"
"fmt"
"sort"
"strings"
"time"
"github.com/mittwald/kubernetes-replicator/replicate/common"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/ap... |
c75c79310441d65d008b55e05e24c04d094fe860 | c3a51ad894b09a741ea276b1169d55df8b61f36d | DennisDenuto/cosign | /cmd/sget/cli/options/root.go | Go | go | 1,176 | permissive | //
// Copyright 2021 The Sigstore 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 ... |
87d86c2f15b757dc787a26183253da362d13e1a4 | 65b26adc91bdb56c499fb7edc343e2991b549f63 | MaulIbra/simple_go_Mysql_enigmaSchool | /utils/screen.go | Go | go | 2,934 | no_license | package utils
import "fmt"
func MainScreen() {
fmt.Println("===========================================")
fmt.Println("===============ENIGMA SCHOOL===============")
fmt.Println("===========================================")
fmt.Println("== 1. Mahasiswa ==")
fmt.Println("== 2. Mata Ku... |
c4f80928e94e49ea4f5e41072160ac3b7be72196 | 6cac7ad360ca92e956b75ede826a82c3a9a7a328 | cloud-native-toolkit/key-management-operator | /util/string_util/main.go | Go | go | 284 | no_license | package string_util
import "encoding/base64"
func Base64StringToBytes(base64Value *string) []byte {
return []byte(*base64Value)
}
func StringToBase64ByteArray(value *string) []byte {
base64Value := base64.StdEncoding.EncodeToString([]byte(*value))
return []byte(base64Value)
}
|
fb3cc9d697f2714b62b4d6e79538168b2b4d5c35 | 5f8b3e020b5b3e4f2f199066132ad0a7d60c5da0 | tandelfulva/TestGit | /ch7_codeMagnets.go | Go | go | 214 | no_license | package main
import "fmt"
func main() {
ranks := map[string]int{"gold": 1, "bronze": 3, "silver": 2}
for medal, rank := range ranks {
fmt.Printf("The %s medal's rank is %d\n", medal, rank)
}
}
|
92f0fec41cdf86fa809fd3fd40780ff6875f9e84 | e96bdd0628a9518ccd27f58978619130a0441018 | mm3/Sia | /types/signatures_test.go | Go | go | 13,416 | permissive | package types
import (
"encoding/json"
"testing"
"github.com/NebulousLabs/Sia/crypto"
)
// TestUnlockHash runs the UnlockHash code.
func TestUnlockHash(t *testing.T) {
uc := UnlockConditions{
Timelock: 1,
PublicKeys: []SiaPublicKey{
SiaPublicKey{
Algorithm: SignatureEntropy,
Key: "fake key",... |
ed2ee5cf7ed465d409faeca493230ce13e85f4a9 | acc64918e6d3ddad6342ee84fe2de1dbd4616e57 | clickyab/clickyab-cyrest | /src/modules/user/aaa/sessions.go | Go | go | 1,685 | no_license | package aaa
import (
"common/redis"
"fmt"
"time"
"github.com/mssola/user_agent"
)
// Session is the active session for a user
type Session struct {
Value string `json:"-"`
Current bool `json:"current"`
Key string `json:"key"`
OS string `json:"os"`
Bro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.