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 |
|---|---|---|---|---|---|---|---|---|
4b0d765774f0ac91a4ce8dfb36ee4cebfedb03f1 | 00547a6f6b624dd14226b597ced3b32b45fa9ce6 | cespare/steller | /result_stats.go | Go | go | 2,383 | permissive | package main
import (
"bytes"
"strings"
"text/template"
"time"
)
type ResultStats struct {
Succeeded int64
Failed int64
Duration time.Duration
Total *Stats
ByStatus map[int]*Stats
}
func NewResultStats() *ResultStats {
return &ResultStats{
Total: NewStats(),
ByStatus: make(map[int]*Stats),
... |
4ea27460309e05a8122ca4924fd8f5c83c4dfe57 | 9a45a5160679d782464fbf8e8bd363281bb51fad | RayFinney/meiso | /service/sensors/repository.go | Go | go | 803 | no_license | package sensors
import (
"context"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
"meiso/influx"
"meiso/models"
"time"
)
type Repository struct {
influxClient influxdb2.Client
}
func NewRepository(influxClient influxdb2.Client) Repository {
return Repository{
influxClient: influxClient,
}
}
func ... |
ca618d604fbe3bedc90ef6ca6a35dd28f90296ec | cbd330bad29ded969a16064e2904dbc7df23eea5 | YarikRevich/MainServer | /Messageparser/messageparser.go | Go | go | 763 | no_license | package Messageparser
import (
"encoding/json"
"log"
)
type Parser interface{
Parse([]*Message)[]byte
Unparse([]byte)([]*Message, error)
}
type Message struct{
Index int
Error string
Type string
Body []string
}
func (m *Message) Parse(message []*Message)[]byte{
... |
d34dbb7dcdd2658088b2395b59649d9c1e09601e | 6eac01bf72769767cdc1aaa63d29dab5b1664aec | githubw2015/kooky | /internal/chrome/find/find.go | Go | go | 1,967 | permissive | package find
import (
"encoding/json"
"errors"
"io/ioutil"
"path/filepath"
"runtime"
)
type chromeCookieStoreFile struct {
Path string
Browser string
Profile string
OS string
IsDefaultProfile bool
}
func FindChromeCookieStoreFiles() ([]*chromeCookieStoreFile, err... |
56dbe442e5784a4a8f809eaa431c847ff1090486 | b10484dc05716c495e376a0a86bfd45af4d0179f | tomwilkie/prometheus-benchmarks | /pkg/test/time_flag.go | Go | go | 604 | permissive | package test
import (
"time"
)
// TimeValue is a model.Time that can be used as a flag.
type TimeValue struct {
time.Time
set bool
}
// NewTimeValue makes a new DayValue; will round t down to the nearest midnight.
func NewTimeValue(t time.Time) TimeValue {
return TimeValue{
Time: t,
set: true,
}
}
// Stri... |
9a7ad28496af064127b22fa7ae96e7c496de406b | 04862b4ac9db9e86287f7f3eeb6a3d590ce229df | Demon-Cloud/jvmgo | /src/jvmgo/ch06/instructions/conversions/i2x.go | Go | go | 1,348 | no_license | package conversions
import (
"jvmgo/ch06/instructions/base"
"jvmgo/ch06/rtda"
)
// Convert int to byte
type I2B struct{ base.NoOperandsInstruction }
func (self *I2B) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
i := stack.PopInt()
b := int32(int8(i))
stack.PushInt(b)
}
// Convert int to ch... |
b15f347b755df23c3987e50c3a61594e97621c87 | ee5f4c68bd86e554c137d5f8cad9732af95b184f | fahedhijazi/temporal | /service/history/replicationDLQHandler_test.go | Go | go | 8,194 | permissive | // Copyright (c) 2020 Uber Technologies, Inc.
//
// 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... |
f7d8188bb070eaa0484433ce46c651c0859c93e5 | 7ffaee33951777b6a2353a2d0b101972d1225997 | rfornea/library | /pkg/backend/routes/response_utils.go | Go | go | 1,855 | no_license | package routes
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/rfornea/library/pkg/backend/utils"
"net/http"
)
const REQUEST_UUID = "request_uuid"
type handlerFunc func(*gin.Context) error
func InternalErrorResponse(c *gin.Context, err error) error {
c.AbortWithStatusJSON(http.StatusInternalServerError, ... |
d16231a27b91d62fb0b6a65b0f7f90aea2ca8106 | c9e7444299defd7cddc37ae32f6087c37bd2a49c | yonidavidson/orbs-network-go | /services/transactionpool/service.go | Go | go | 7,032 | permissive | package transactionpool
import (
"context"
"fmt"
"github.com/orbs-network/orbs-network-go/crypto/digest"
"github.com/orbs-network/orbs-network-go/crypto/signature"
"github.com/orbs-network/orbs-network-go/instrumentation/log"
"github.com/orbs-network/orbs-network-go/synchronization"
"github.com/orbs-network/orb... |
4fb4e974b68d4ce48d8de4e4df6ecf78b2de667b | 43d1188bec5d24aa9f7c0422ee1e15a8a1a2925c | nya3jp/tast-tests | /src/chromiumos/tast/local/bundles/cros/security/user_files_logged_in.go | Go | go | 845 | permissive | // Copyright 2018 The Chromium OS 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 security
import (
"context"
"chromiumos/tast/local/bundles/cros/security/userfiles"
"chromiumos/tast/local/chrome"
"chromiumos/tast/testi... |
79277aa6437d3c7d6bc40f69c470702a554c6e05 | 1c0b952ca004b57edbe44805038e6082d451c701 | c0va23/csi-lvm | /cmd/controller/main.go | Go | go | 5,890 | permissive | package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/pkg/errors"
"github.com/urfave/cli/v2"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog"
pvController "sigs.k8s.io/sig-storage-lib-external-provisioner/v5/controller"
)
var (
flagProvisionerName = "pro... |
41ebea3c00e20817ffe3af0605c22a5b76ccbe53 | 3673546ab6d6fad7ce0bd23b74830da92ca6a5f5 | hossnys/0-orchestrator | /api/tools/http.go | Go | go | 1,597 | permissive | package tools
import (
"encoding/json"
"fmt"
"net/http"
log "github.com/Sirupsen/logrus"
)
func WriteError(w http.ResponseWriter, code int, err error, msg string) {
tracebackError := err.Error()
log.Errorf(tracebackError)
if msg == "" {
msg = tracebackError
}
w.Header().Set("content-type", "application/js... |
52ef57c87712366100133c76492217488bb24542 | ead75303d149d2d2e1bf5b9095461ee108d4d851 | 74123691475963u/gitrob | /common/sourcecontrol.go | Go | go | 4,267 | permissive | // Package common contains functionality not critical to the core project but still essential.
package common
// TODO refactor out the common package
import (
"errors"
"fmt"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/go-git.v4/utils/... |
034ac3d6e4043999404a059abadaa07465c6fa83 | c39694bacd4bb7448901c973774f5d76f5f8625d | quentin-cha/knative-gcp | /pkg/reconciler/trigger/controller.go | Go | go | 5,096 | permissive | /*
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
6813780a2fc9585037779de8eb60f73b4ffbd484 | 8235b5ec29e4b7f05b49f0d6828fa4f13cd1fe69 | zhangatle/go-gin-example | /pkg/setting/setting.go | Go | go | 1,065 | no_license | package setting
import (
"github.com/go-ini/ini"
"log"
"time"
)
var (
Cfg *ini.File
RunMode string
HTTPort int
ReadTimeout time.Duration
WriteTimeout time.Duration
PageSize int
JwtSecret string
)
func init() {
var err error
Cfg, err = ini.Load("conf/app.ini")
if err != nil {
... |
e30c40dfc904f3fa8924b3085849468496614fbe | ad9c6816afb535cc05859274c32c25028e7d616d | zhulingbiezhi/leetcode | /sort/insert_sort_test.go | Go | go | 701 | no_license | package sort
import (
"reflect"
"testing"
)
func Test_insertSort(t *testing.T) {
type args struct {
arr []int
}
tests := []struct {
name string
args args
want []int
}{
{
name: "test 1",
args: args{
arr: []int{1, 9, 4, 7, 0, 5, 3},
},
want: []int{0, 1, 3, 4, 5, 7, 9},
},
{
name: ... |
094fd0677f6f750994f7305edb25af8905a6f0ce | bd615506bd86eb286fd43d0134a301c6e639d0ae | i365k/plant | /other/handler/example.go | Go | go | 32,490 | no_license | package handler
import (
"context"
example "plant/other/proto/example"
"github.com/astaxie/beego/orm"
"encoding/json"
"github.com/astaxie/beego/cache"
_ "github.com/astaxie/beego/cache/redis"
_ "github.com/gomodule/redigo/redis"
_ "github.com/garyburd/redigo/redis"
"github.com/garyburd/redigo/redis"
"plant/g... |
07a6474112ef85e2112d37bac9d4454b32b12260 | 152d4e631bb5c94d490b6f2400a56dd8c12cae6f | Tenbagger/clash | /rule/geoip.go | Go | go | 974 | permissive | package rules
import (
"strings"
"github.com/Dreamacro/clash/component/mmdb"
C "github.com/Dreamacro/clash/constant"
)
type GEOIP struct {
country string
adapter string
noResolveIP bool
}
func (g *GEOIP) RuleType() C.RuleType {
return C.GEOIP
}
func (g *GEOIP) Match(metadata *C.Metadata) bool {
ip ... |
778bf39044ff1955b4f7d6c0183a2b2d2e868cdd | b3e94eb05d6380fb2eda490978b66f4969247ba2 | babaev/quickfix | /validation_test.go | Go | go | 17,678 | permissive | package quickfix
import (
"testing"
"time"
"github.com/quickfixgo/quickfix/datadictionary"
)
type validateTest struct {
TestName string
Validator validator
MessageBytes []byte
ExpectedRejectReason int
ExpectedRefTagID *Tag
DoNotExpectReject bool
}
func TestValidate(t *... |
f59fbe6d6e702890377321ee9ba836fd5fe21f9f | a2e90f843cd4ac7e5adda7b7114888cf61c1d913 | sallyom/installer | /terraform/providers/aws/vendor/github.com/hashicorp/terraform-provider-aws/internal/service/appmesh/mesh_data_source.go | Go | go | 2,903 | permissive | package appmesh
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/appmesh"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
)
func ... |
4adb53cccad13c2120a7fd5465b0a7de7982aed5 | 734b648deff1f0d4d1b1d1bb15ca1965855b9149 | ankitanwar/DataStructure | /binarytree/implementBinaryTree.go | Go | go | 1,984 | no_license | package binarytree
import (
"fmt"
"strconv"
)
//These can have atmost 2 chil
//Dosent necessary follows binary search tree property
//Node : Node of a binary Tree
type Node struct {
Data interface{}
Left *Node
Right *Node
Lis int
}
type stack struct {
Value *Node
Operation int // 1 -> push to the le... |
278ebad73b7e98d68aa1e08cabc54ea017f994f8 | 4dca80463f8e9ae83779c80eaff9a6fd6f411cfc | mhentz/please | /src/parse/asp/targets.go | Go | go | 16,475 | permissive | package asp
import (
"os"
"path"
"strings"
"time"
"github.com/thought-machine/please/src/cli"
"github.com/thought-machine/please/src/core"
"github.com/thought-machine/please/src/fs"
)
// filegroupCommand is the command we put on filegroup rules.
const filegroupCommand = pyString("filegroup")
// hashFilegroup... |
f9fb1ca333deec947ef05b451059c48baee26bed | 16ad8ae6a8709869a48272fba1fdb48460a8c6ce | straiforos/lotus | /itests/deals_power_test.go | Go | go | 1,563 | permissive | package itests
import (
"context"
"testing"
"time"
"github.com/filecoin-project/lotus/itests/kit"
)
func TestFirstDealEnablesMining(t *testing.T) {
// test making a deal with a fresh miner, and see if it starts to mine.
if testing.Short() {
t.Skip("skipping test in short mode")
}
kit.QuietMiningLogs()
v... |
98356b3e7e800fd07e4af31bb3aa615d3f9a206e | d88e349cb076c86410dbe4b59f684e3a00285a67 | mdavis333/geo | /s2/edge_clipping_test.go | Go | go | 18,119 | permissive | // Copyright 2017 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... |
5bc068c72f1bf08b3036e209a8b6f56e81c07100 | f2e9bed3da8279f754391541df31c9ba41196773 | jashwantraj92/brigade | /vendor/cloud.google.com/go/internal/gapicgen/generator/gapics.go | Go | go | 15,215 | permissive | // Copyright 2019 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 ... |
bf27ebeaffa1e2d83b05710bde4fdc74e6d65580 | 2b4d111e73eb3335372836a88868b673630e7d96 | kok4/mydemo | /server/src/vendor/github.com/hashicorp/consul/acl.go | Go | go | 3,502 | no_license | package consul
const (
// ACLCLientType is the client type token
ACLClientType = "client"
// ACLManagementType is the management type token
ACLManagementType = "management"
)
// ACLEntry is used to represent an ACL entry
type ACLEntry struct {
CreateIndex uint64
ModifyIndex uint64
ID st... |
ed51ca7d73095a427fc0f8d38e76afff98009bf9 | c4fc98574a7dca36421ac76c9f4b9ffd89619cf6 | creachadair/kythe | /kythe/go/storage/stream/stream.go | Go | go | 6,541 | permissive | /*
* Copyright 2014 The Kythe Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... |
fbce1678bf415886da3c1a7fd6a088755b73692c | fd3d77fa125c74c463ed3c8f749f84459d64cb04 | huaweicloud/huaweicloud-sdk-go-v3 | /services/eihealth/v1/model/model_import_network_data_response.go | Go | go | 519 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ImportNetworkDataResponse Response Object
type ImportNetworkDataResponse struct {
// 数据作业ID
Id *string `json:"id,omitempty"`
HttpStatusCode int `json:"-"`
}
func (o ImportNetworkDataResponse) String... |
f7c375085812a302e3530d77b8a67f7e1b11dc66 | a2dbfa9af9da0580a1a5fa4ea9b19a52984588c9 | SmartMeshFoundation/Photon | /models/gkvdb/channels.go | Go | go | 5,901 | no_license | package gkvdb
import (
"fmt"
"github.com/SmartMeshFoundation/Photon/rerr"
"github.com/SmartMeshFoundation/Photon/channel/channeltype"
"github.com/SmartMeshFoundation/Photon/log"
"github.com/SmartMeshFoundation/Photon/models"
"github.com/SmartMeshFoundation/Photon/models/cb"
"github.com/SmartMeshFoundation/Pho... |
00eeb03ea68c9c033f55ac32f607a4d15afceb6d | 4385b0ba3df75920a1928284a024561c6cb5885f | gofunky/githttp | /githttp_test.go | Go | go | 5,822 | permissive | package githttp
import (
"errors"
"gopkg.in/src-d/go-git.v4"
gogit "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
"time"
)
const (
gitRefs = "/info/refs?service="
uploadPack = "git-upload-pack"
... |
5403a15287616df78386d9292a07a436208a3e45 | 8d827eb14b9a85c9a5dc4d1385bef0fdfa39c0c3 | mehulsbhatt/tidb | /executor/executor_write.go | Go | go | 22,225 | permissive | // Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
df703d5fedb9c15df03f3fc9fd5f758f3c3c5656 | ad6104bfe9d917ec9bf480b71ece0bbc6a1f86b4 | cdrage/reg | /vendor/github.com/docker/docker-ce/components/engine/daemon/kill.go | Go | go | 5,664 | permissive | package daemon
import (
"context"
"fmt"
"runtime"
"syscall"
"time"
containerpkg "github.com/docker/docker/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/libcontainerd"
"github.com/docker/docker/pkg/signal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
type errNoSuchProces... |
7d50eaa4cc639680031a73483ed2d28bbe54af61 | 8fbfdc54a6510ba9a8896924289f45bac2c3fecd | borjamunozf/proglog | /cmd/server/main.go | Go | go | 208 | no_license | package main
import (
"log"
"github.com/borjamunozf/proglog/internal/server"
)
func main(){
log.Print("Starting http server...")
srv := server.NewHTTPServer(":8080")
log.Fatal(srv.ListenAndServe())
}
|
53507e41c1ad18a488e8c62fe30ca9dfd0aa07f2 | cb12aaaa786302510a5e234d29a46c5c23daf458 | furkanefe-oss/kit | /remote/validation/validate.go | Go | go | 6,978 | permissive | package validation
import (
"fmt"
"strings"
"github.com/asaskevich/govalidator"
plumbing2 "github.com/make-os/kit/remote/plumbing"
"github.com/make-os/kit/remote/types"
"github.com/make-os/kit/types/core"
"github.com/make-os/kit/types/state"
"github.com/make-os/kit/util"
errors2 "github.com/make-os/kit/util/... |
127499681ee2941060a0f17e186393e220001351 | fdecf160f6220e86cbcee82862ae0b0c934872d7 | carstenpohllhind/tanka | /pkg/kubernetes/reconcile_test.go | Go | go | 828 | permissive | package kubernetes
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestExtract(t *testing.T) {
tests := []struct {
name string
data testData
err error
}{
{
name: "regular",
data: testDataRegular(),
},
{
name: "flat",
data: testDataFla... |
695fb18d06c0a68c707507573b104cad24e407ea | 53b472fc36963b9445844b8affbc6eb0fe8077a9 | Bala-Allam-Bose/go-ps | /process_solaris.go | Go | go | 2,906 | permissive | // +build solaris
package ps
import (
"encoding/binary"
"fmt"
"os"
)
type ushort_t uint16
type id_t int32
type pid_t int32
type uid_t int32
type gid_t int32
type dev_t uint64
type size_t uint64
type uintptr_t uint64
type timestruc_t [16]byte
// This is copy from /usr/include/sys/procfs.h
type psinfo_t struct ... |
9a60a0587f1d4a24a47f75f421c0fcfdb6b21766 | 2bbfb57c881b39b26fe8f25be3a93bed0a77b8b1 | LounesBrahimi/Coroutine-golang | /channelCommunication.go | Go | go | 364 | no_license | package main
import "fmt"
func writer(channel chan int, word string) {
for true {
<-channel
fmt.Println(word)
channel <- 0
}
}
func main() {
firstChannel := make(chan int)
go func() { writer(firstChannel, "Hello") }()
go func() { writer(firstChannel, "World") }()
go func() { writer(firstChannel, "Welcome... |
09aad6e4eb603dd2c526be157ecc4438c6937c25 | a195ca37696df570f7afd68050c3692db73bc019 | RTradeLtd/go-ipfs-plugin-i2p-gateway | /vendor/gx/ipfs/QmUWtNQd8JdEiYiDqNYTUcaqyteJZ2rTNQLiw3dauLPccy/gomega/matchers/have_occurred_matcher.go | Go | go | 960 | permissive | package matchers
import (
"fmt"
"gx/ipfs/QmUWtNQd8JdEiYiDqNYTUcaqyteJZ2rTNQLiw3dauLPccy/gomega/format"
)
type HaveOccurredMatcher struct {
}
func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) {
// is purely nil?
if actual == nil {
return false, nil
}
// must be an 'erro... |
80c1d4ddbcb5a62c5a8daec1b1827e4c8207b2dd | 9918f99ba900d7bc847267554593ba196c778ac6 | Clever/wag | /swagger/types.go | Go | go | 1,718 | permissive | package swagger
import (
"fmt"
"strings"
"github.com/go-openapi/spec"
)
// TypeFromSchema returns the type of a Swagger schema as a string. If includeModels is true
// then it returns models.TYPE
func TypeFromSchema(schema *spec.Schema, includeModels bool) (string, error) {
// We support one of two schemas:
// ... |
66d5738e51b8cc695b3fd5429d3ff0d35fc8187f | c341f63fcbfff95e31d69905b61acde4426b45e6 | famigo/header | /ines/ines.go | Go | go | 535 | no_license | package ines
type (
//PRG defines the number of 16KB PRG ROM banks in a NES ROM
PRG byte
//CHR defines the number of 8KB CHR ROM banks in a NES ROM
CHR byte
//MAP defines the Mappers number of a NES ROM
//
//For a list of available mappers, see https://wiki.nesdev.com/w/index.php/Category:INES_Mappers
MAP by... |
3559dccfc5f426ee421ea34ba2784781e8b4c853 | 908677a11f4da9a55504595132160834459b4b70 | jerop/pipeline | /pkg/container/sidecar_replacements.go | Go | go | 1,083 | permissive | /*
Copyright 2020 The Tekton 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,... |
5c1e3673d2ad2f1e67b4e385565ed795cb0af1f0 | 31e9dd633d9875c0298ca13209f34f08dfad8010 | hezhenke/algorithm010 | /Week09/reverseStr.go | Go | go | 252 | no_license | func reverseStr(s string, k int) string {
str :=[]byte(s)
var i int
for i<len(str){
l:=i
r:=i+k-1
if r>=len(str){
r =len(str)-1
}
for l<r&&l<len(str){
str[l],str[r]=str[r],str[l]
l++
r--
}
i=i+2*k
}
return string(str)
}
|
620bd42be788af1dad372ebbc9ad0dc6bebf6f3a | b474816a9b847317bb025d33d675a51c251393ee | jaybutera/market_monitor | /indicators/macd.go | Go | go | 7,870 | permissive | // Moving Average Convergence and Divergence (Macd)
package indicators
import (
"errors"
"github.com/jaybutera/gotrade"
)
// A Moving Average Convergence-Divergence (Macd) Indicator
type Macd struct {
*baseIndicator
*baseFloatBounds
// private variables
valueAvailableAction ValueAvailableActionMacd
fastTimePe... |
cb3162336a6374937c105ca26032f82e7483e7a2 | 202467a46a5039f9717896210fad5dc380dcd9f2 | njnuwjq/servicecomb-service-center | /datasource/etcd/bootstrap/bootstrap.go | Go | go | 1,611 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
5653c7b56f49cd3f4208b9b072fd275dd179f414 | eb939c15220eeae895156aaaa5ffc1a49478a691 | meldafrawi/longhorn-engine | /pkg/backingfile/backingfile.go | Go | go | 2,664 | permissive | package backingfile
import (
"bufio"
"bytes"
"fmt"
"os"
"os/exec"
"strings"
"syscall"
"github.com/longhorn/sparse-tools/sparse"
"github.com/longhorn/longhorn-engine/pkg/qcow"
"github.com/longhorn/longhorn-engine/pkg/types"
"github.com/longhorn/longhorn-engine/pkg/util"
)
const defaultSectorSize = 512
ty... |
fc291bc8bf992e02a45d996da62a84999ba22114 | b274e7336279f6b55b3e0c8f341e62f9050bda0c | dkstsh/multi-cloud | /api/pkg/dataflow/service.go | Go | go | 13,163 | permissive | // Copyright 2019 The OpenSDS 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 agre... |
bb524262ad0dea75385aa027f5cd0f3ebe76226b | 84686f910f1209f7d931d27b47515ef4c25f8036 | ecletus/admin | /pagination.go | Go | go | 452 | permissive | package admin
// PaginationPageCount default pagination page count
var PaginationPageCount = 100
// Pagination is used to hold pagination related information when rendering tables
type Pagination struct {
Total int
Pages int
CurrentPage int
PerPage int
UnlimitedEnabled bool
/... |
85bc95a464041bcdd8b785a7b51db185b7735a3a | 85f73fc3c97d2b9d397d1a0aa94fd824089582d1 | serverlessui/UIaaS-api | /account/handler/accountmarshaller_test.go | Go | go | 418 | no_license | package handler
import "testing"
func TestMarshallAccountStructToString(t *testing.T) {
expected := "{ACCOUNTID NAME }"
account := Account{
AccountID: "ACCOUNTID",
Name: "NAME",
}
actual, err := MarshallAccountStructToString(&account)
if err != nil {
t.Log("Got error when none expected ", err)
... |
a962dddcee6a199e7be558b13cf79bbb72392af3 | 30bc59db1ca29a96e9d2360971541259ccf5f175 | masch712/sql_exporter | /vendor/github.com/snowflakedb/gosnowflake/datatype_test.go | Go | go | 1,238 | permissive | // Copyright (c) 2017-2019 Snowflake Computing Inc. All right reserved.
package gosnowflake
import (
"database/sql/driver"
"fmt"
"testing"
)
type tcDataTypeMode struct {
tp driver.Value
tmode string
err error
}
func TestDataTypeMode(t *testing.T) {
var testcases = []tcDataTypeMode{
{tp: DataTypeTimest... |
a3773236f5e20a56202fcf4ecc9286a7274c4712 | 87307b03014d788074b21d3eda783321d11162e4 | google/go-containerregistry | /pkg/v1/stream/layer_test.go | Go | go | 8,623 | permissive | // Copyright 2018 Google LLC 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 l... |
6fd4d6bbc6c2aac4412b41690ce6583f9a3eabea | d695798709aabd50a08c8537708f6f48ae15a82c | tonymontaro/leetcode-hints | /internal/leetcode/base.go | Go | go | 2,481 | permissive | package leetcode
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"time"
"github.com/openset/leetcode/internal/base"
"github.com/openset/leetcode/internal/client"
)
var (
authInfo = base.AuthInfo
checkErr = base.CheckErr
filePutContents = base.FilePu... |
1c1f6691ae00378a280c61dd2954803ec89ce62c | 8aed74d2c0a8be0c91f23a75c58ea6b87c91e09a | GlobalWebIndex/elastic | /search_aggs_metrics_value_count_test.go | Go | go | 1,666 | permissive | // Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"testing"
"github.com/json-iterator/go"
)
func TestValueCountAggregation(t *testing.T) {
agg := NewValueC... |
2ee99cfca5065b7495573ee6b3d117e414d8dbfd | e503ba7e6228bfe0bba6c8f4ba3e01fdff2eaf43 | PYW1/momonga | /encoding/mqtt/publish.go | Go | go | 2,270 | permissive | // Copyright 2014, Shuhei Tanuma. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
package mqtt
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"io"
)
type PublishMessage struct {
FixedHeader `json:"header"`
TopicName s... |
ea9e4d95e2857e4132601d0975bc0d652c990cb9 | 767a322c6eca6f1acc3b7555ac530b600d90b8e9 | woodpecker-ci/woodpecker | /server/forge/gitlab/gitlab_test.go | Go | go | 6,371 | permissive | // Copyright 2022 Woodpecker Authors
// Copyright 2018 Drone.IO 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 req... |
c1a158e365cdd18b8f55775f0cbf0fc023ef2db5 | c31b817302f1147167a116b3ea1a91ef48b7719a | Syn3rman/opentelemetry-collector | /pdata/pmetric/alias.go | Go | go | 4,086 | 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... |
76248e03d3b8040f55fd6dd934f8d193dc6bb777 | 322ab473109aee368924ffcc6706941be0747f04 | fulmicoton/skywalking-eyes | /pkg/deps/golang.go | Go | go | 4,789 | permissive | //
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the ... |
471158f581b5c5421d3a17b2332cd138db8cc39a | 279d6ce191276a933c48dcb316fe53b672755cd3 | keylxiao/Oilfield_backend | /Desktop/Oilfield_backend/models/Equip.go | Go | go | 3,797 | no_license | package models
import (
"Oilfield_backend/utils"
)
type Ipc struct {
Id int `gorm:"primary_key;auto_increment"` // 自增主键
Number string // 设备序列号
Name string // 设备名称
Account string // 设备账号
Password string // 设备密码
Ip string // 设备ip
Nvr string... |
48da78722df4cb92497246172a6ae6a5091ad225 | 3dadd027f97f055e7b9604cc8fd761958e425113 | shanexu/go-catman-examples | /playground/election/main.go | Go | go | 616 | permissive | package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
"github.com/shanexu/go-catman"
)
func main() {
cm, err := catman.NewCatMan([]string{"127.0.0.1:2181"}, time.Second)
if err != nil {
panic(err)
}
defer cm.Close()
l := cm.NewLeaderElectionSupport("myhost", "/election")
l.AddListener(catman.Le... |
6bfdad3cf659bc34fec37cb24807c9546822fda9 | 645f4e7774589669adfc37986f53a578868742e1 | jakeactually/advent-of-code-2017 | /08/a/main.go | Go | go | 846 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
file, _ := os.Open("input.txt")
scanner := bufio.NewScanner(file)
regs := make(map[string]int)
for scanner.Scan() {
words := strings.Split(scanner.Text(), " ")
b, _ := strconv.Atoi(words[6])
if cond(regs[words[4]], words[5],... |
d602bec5381f6d5139dc2f02fa021c6e95cca59e | 1a72d2a974ac26c23efb3446a127126e07ac8a4a | WhiteHeal/softserve | /docker/app/main.go | Go | go | 218 | no_license | package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Softserve!!: %s\n", r.URL.Path)
})
http.ListenAndServe(":80", nil)
}
|
d948e33864007e08e4d087542aaf91cb5b06b73a | b10471e25dd40d4519e188e515b09600f04045ca | Andrew-Luo1/wio | /cmd/wio/commands/run/dependencies/flags.go | Go | go | 4,626 | permissive | package dependencies
import (
"regexp"
"strings"
"wio/cmd/wio/errors"
"wio/cmd/wio/utils"
)
// Verifies the placeholder syntax
func placeholderSyntaxValid(flag string) bool {
pat := regexp.MustCompile(`\$\([a-zA-Z0-9=_-]+\)`)
s := pat.FindString(flag)
return s != ""
}
// matches a flag b... |
02c9bcaacc36288dd052402346dd885e3031d289 | 5ee82a4c7f2e385cc6c6d13d735e32794194db8a | magnuswahlstrand/codingplane | /103_sliding_rectangles/main.go | Go | go | 2,961 | no_license | package main
import (
"fmt"
"image"
"math"
"github.com/hajimehoshi/ebiten/ebitenutil"
"golang.org/x/image/colornames"
"github.com/hajimehoshi/ebiten"
"github.com/peterhellberg/gfx"
)
const (
w, h = 440, 440
padding = 40
)
type Pixel struct {
pos gfx.Vec
amplitude float64
}
type Rectangle stru... |
06d8bf1fa844e9aff04e8476816b68e457fa6c99 | 507d6017dd6d953d87de54db2eb3876ff41a30b1 | zeromem/query | /inferencer/document_retrievers.go | Go | go | 8,548 | no_license | package inferencer
import (
"fmt"
"math"
"github.com/couchbase/go-couchbase"
"github.com/couchbase/query/datastore"
"github.com/couchbase/query/value"
)
//
// we need an interface describing access methods for getting a set
// of documents, since we might be getting them using random sampling via KV,
// and we ... |
30f22b54c9716e963d86256bc6cedf55ed6b9833 | 7a8f0bfdd5434b49c5f4e95f8843486c794fba76 | qianlidongfeng/sparrow | /gate/config.go | Go | go | 2,377 | no_license | package gate
import (
"flag"
"io/ioutil"
"encoding/json"
"github.com/qianlidongfeng/log"
"path/filepath"
"os"
)
var(
g_config Config
)
func init(){
g_config = Config{}
g_config.Init()
}
type Config struct{
ServerID int64
TcpPort string
WebsocketPort string
MaxConnection uint64
WirteQueLen uint64
MaxM... |
7d4b4fcb9c17980edaa2e7a9529d7ca13471196f | f1f0f128d7c3e2523316dd72165da7c98c30fbed | encodeering/mumbledj | /bot/queue.go | Go | go | 9,580 | permissive | /*
* MumbleDJ
* By Matthieu Grieger
* bot/queue.go
* Copyright (c) 2016 Matthieu Grieger (MIT License)
*/
package bot
import (
"errors"
"fmt"
"math/rand"
"os"
"sync"
"time"
"layeh.com/gumble/gumbleffmpeg"
_ "layeh.com/gumble/opus"
"github.com/matthieugrieger/mumbledj/interfaces"
"github.com/spf13/vipe... |
b67918738f6fc1a3feed24f1653c19ff001f809b | 3e9699e5e0b42173bdf8772c448c7cb0be0272ed | checkr/codeflow | /server/vendor/github.com/docker/docker/client/service_inspect.go | Go | go | 962 | permissive | package client
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/url"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"golang.org/x/net/context"
)
// ServiceInspectWithRaw returns the service information and the raw data.
func (cli *Client) ServiceInspectWithRaw(ctx cont... |
2f2eb8fe8e43d3f1cac6d3ee41d53c207f3044ae | f968d1246cf838a1f62e00bd4bd3ca57130897c0 | influx6/coquery | /client/client.go | Go | go | 8,766 | no_license | package client
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"sync"
"sync/atomic"
"time"
"github.com/influx6/coquery/data"
"github.com/influx6/faux/utils"
)
//==============================================================================
// ServeTransport defines an interface for requests transport... |
c8759450c79820c9904c8bbaa309a32d7df6c668 | 7c32e7f9d4ec21560e610bc0f97a6dfc59b64dc3 | ffromani/nri | /api/plugin/vproto/types.go | Go | go | 2,430 | permissive | /*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... |
db10b121e634a6cbc0ea8a8bfb11ab061a22afc5 | 0a950e5b0521c253644491a5c4ae174529da031b | YeswanthRajakumar/golang_roadmap_-_snippets | /2.cards/deck_test.go | Go | go | 1,197 | no_license | package main
import (
"bytes"
"os"
"testing"
)
func TestCreateDeck(t *testing.T) {
d := createDeck()
if len(d) != 52 {
t.Errorf("Expected 52 but got %v", len(d))
}
if d[0] != "Ace of Hearts" {
t.Errorf("Expected first card is Ace of Hearts but got %v", d[0])
}
if d[len(d)-1] != "King of Spades" {
t.Er... |
413bece6b6f4ee7951a046abacf78317885edc47 | 98b72eae55975d66b4c500047e4799aa834dbf2b | yangminzhu/istio | /broker/pkg/model/osb/servicePlan.go | Go | go | 1,238 | permissive | // Copyright 2017 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 i... |
af8610d095d33f9752a4eccf8ccd0af585dbb2d6 | 7cd38608642e9409d08005fd831fbcbd4f7d4c80 | aws/amazon-ssm-agent | /agent/session/telemetry/metrics/service_test.go | Go | go | 1,113 | permissive | // Copyright 2021 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 "license" fil... |
4d78784b12535ff81ec34c153e6a2b1a3e642b41 | ace1aa17ed381734b10ca7d3c33ad3b351d9f88f | luislopez3601/meshery | /mesheryctl/internal/cli/root/system/context/switch.go | Go | go | 1,015 | permissive | package context
import (
"errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// switchContextCmd represents the switch command
var switchContextCmd = &cobra.Command{
Use: "switch <context-name>",
Short: "switch context",
Long: `Configure meshe... |
d5cf6137349432639d5dbacbcf73a5e532727b77 | 1c96dfa4eb0b5d3042bf486f24f3773ee804b6ff | lental/aws-sdk-go | /service/kms/kmsiface/interface.go | Go | go | 8,050 | permissive | // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package kmsiface provides an interface to enable mocking the AWS Key Management Service service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API op... |
de3a2d1e740b20ba29f7a3c5c2665c45338ba3ae | 6a52c7a85b961374394d78030b98eb9278ac9ab3 | TonyDoen/go_code_review | /hi-foundation/for.go | Go | go | 228 | no_license | package main
import "fmt"
func main() {
i := 1
for i < 5 {
fmt.Println(i)
i += 1
i++ //not available for python
}
for i = 0; i < 10; i++ {
fmt.Print(i, " ")
}
for {
fmt.Print("\n" + "ever loop")
break
}
}
|
a2292b03ff069be35f9b0f3f543d52401a7904bd | 74157902c21ddab4088f6fe1245162b575be8622 | nicolas-lepinay/Bachelor1__Golang | /trimatoi.go | Go | go | 681 | no_license | package piscine
func TrimAtoi(s string) int {
runes := []rune(s)
value := 0
count := 0
nombre := 0
mt := 1
var a []int
for l := 0; l < len(runes); l++ {
if 47 < s[l] && s[l] < 58 || s[l] == 43 || s[l] == 45 {
value = int(s[l])
a = append(a, value)
... |
48c8388326f778c8b409aefd030e890da79acf46 | ad7806fa2cfcab5debcce970fcfe290583f074c0 | AmirAbrams/web-bridge | /rpc/dynamic/hashcheck.go | Go | go | 2,268 | permissive | package dynamic
import (
"errors"
util "github.com/duality-solutions/web-bridge/internal/utilities"
)
func checkBinaryHash(_os, hashDynamicd, hashCli string) error {
switch _os {
case "Windows":
if winDyndHash != hashDynamicd {
util.Error.Println("Error with", dynamicdName, ". File hash mismatch", winDyndHa... |
0963791bc8cb417eb97b45083ccd6e90bfcfcb47 | d128e33ce443851b1f92f888b80fef0751faa079 | fbenz/osmrouting | /src/route/heap_test.go | Go | go | 1,668 | permissive | /*
* Copyright 2014 Florian Benz, Steven Schäfer, Bernhard Schommer
*
* 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... |
2b85ffcff69f218846bf8edf7ae3c31cdc935dc3 | 75d6bc13f117438728ec8c65c556983d08729e9b | Yang-Onion/GoLearning | /src/grammar/gobyexamples/arrays.go | Go | go | 383 | permissive | package main
import "fmt"
func funcArr() {
var arr [5]int
fmt.Println("emp:", arr)
arr[4] = 100
fmt.Println("set:", arr)
fmt.Println("get:", arr[4])
fmt.Println("length:", len(arr))
b := [5]int{1, 2, 3, 4, 5}
fmt.Println("dcl:", b)
var secArr [2][3]int
for i := 0; i < 2; i++ {
for j := 0; j < 3; j++ ... |
9cc3329edcfdd40f078c269c12ac44b88a9eccad | c559061b1dbabaf0f36fe576639aa2f510382c06 | etsangsplk/stack-deployment-tool | /cmd/root.go | Go | go | 3,031 | permissive | //
// Copyright 2016 Capital One Services, 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... |
f186d9f05430d1d04e87aef0eb36274696f5c255 | 3185e024127ab1c4a78c56f1704427a1b563304b | pterm/pterm | /box_printer.go | Go | go | 13,554 | permissive | package pterm
import (
"fmt"
"io"
"strings"
"github.com/mattn/go-runewidth"
"github.com/pterm/pterm/internal"
)
// BoxPrinter is able to render a box around printables.
type BoxPrinter struct {
Title string
TitleTopLeft bool
TitleTopRight bool
TitleTopCenter ... |
57290dcc8bc8548f9b2af520aecbf0a8e4fb6015 | 8d1211aabd04d532cfd205983ee05cb8baacadfc | SamTS/fn | /api/datastore/internal/datastoreutil/metrics.go | Go | go | 3,843 | permissive | package datastoreutil
import (
"context"
"go.opencensus.io/trace"
"github.com/fnproject/fn/api/models"
)
func MetricDS(ds models.Datastore) models.Datastore {
return &metricds{ds}
}
type metricds struct {
ds models.Datastore
}
func (m *metricds) GetTriggerBySource(ctx context.Context, appId string, triggerTy... |
c647a6ae568d665294857629969872555afc625c | 2f4e2e08f35609d9e960e8a0f9563859a3a3c8f2 | Vungle/vungo | /openrtb/banner_test.go | Go | go | 886 | no_license | package openrtb_test
import (
"reflect"
"testing"
"github.com/Vungle/vungo/openrtb"
"github.com/Vungle/vungo/openrtb/openrtbtest"
)
var BannerModelType = reflect.TypeOf(openrtb.Banner{})
func TestBannerMarshalUnmarshal(t *testing.T) {
openrtbtest.VerifyModelAgainstFile(t, "banner.json", BannerModelType)
}
fun... |
d975ac8128fb9175e68071f1b839089b94506294 | c7b4836a08d308d9429ab82086433c3da532f154 | yangchuang64/qmoon_qos_agent | /mudule/distribution/query.go | Go | go | 1,084 | permissive | package distribution
import (
"fmt"
"github.com/QOSGroup/qbase/client/context"
btypes "github.com/QOSGroup/qbase/types"
"github.com/QOSGroup/qos/module/distribution/types"
"github.com/tendermint/go-amino"
)
//func QueryValidatorPeriod(cdc *amino.Codec, validatorAddr string) (result mapper.ValidatorPeriodInfoQuer... |
08c37797e9a05c0f9567fba1685f53fea80ba41b | feda899d48c600086b7726f90114dcf8d6713e1e | jessiepyx/cs425_distributed_systems_mp4_MapReduce | /main.go | Go | go | 9,615 | no_license | package main
import (
"bufio"
"bytes"
"fmt"
"io"
"k8s.io/apimachinery/pkg/util/sets"
"log"
"net/rpc"
"os"
"path"
"strconv"
"strings"
"time"
)
var mainChannel = make(chan string)
type RPCTask struct {
fileName string
ip string
call rpc.Call
}
func (mj *MapleJuiceServer) ScheduleMapleTask(cmd... |
f8b22d069dab3c83cf0a89b82f33b8a134b6e43b | d9fef27f54e3849815b4f9d9018df47f2e5a97b8 | ellcrys/docker | /pkg/term/term.go | Go | go | 3,190 | permissive | // +build !windows
// Package term provides structures and helper functions to work with
// terminal (state, sizes).
package term // import "github.com/ellcrys/docker/pkg/term"
import (
"errors"
"fmt"
"io"
"os"
"os/signal"
"golang.org/x/sys/unix"
)
var (
// ErrInvalidState is returned if the state of the ter... |
616b5461a21fcfcf176719c6740d312c61cee417 | 4d10f83f7123c6e88588d8624221a0eae05cdb6d | RoomReady/gozw | /cc/sensor-multilevel/get.gen.go | Go | go | 983 | permissive | // THIS FILE IS AUTO-GENERATED BY ZWGEN
// DO NOT MODIFY
package sensormultilevel
import (
"encoding/gob"
"github.com/rmacster/gozw/cc"
)
const CommandGet cc.CommandID = 0x04
func init() {
gob.Register(Get{})
cc.Register(cc.CommandIdentifier{
CommandClass: cc.CommandClassID(0x31),
Command: cc.CommandI... |
f62a94ae0863f8817891e5b8e6865bab9344d731 | ac9749fa40ab2d064f44a475515ead2bf461cb50 | littlespace/gocast | /controller/consul.go | Go | go | 4,791 | no_license | package controller
import (
"encoding/json"
"fmt"
"github.com/golang/glog"
"net/http"
"net/url"
"os"
"strings"
"time"
)
const (
consulNodeEnv = "CONSUL_NODE"
allowStale = "CONSUL_STALE"
matchTag = "enable_gocast"
nodeURL = "/catalog/node"
remoteHealthCheckurl = "... |
0e3b11ab2d2c780b8395314b48797812d2c7fd2f | 002e5efedc6e2053fd7019c1df910e2cb8856aba | sevico/sorm | /session/hooks.go | Go | go | 678 | no_license | package session
import (
"reflect"
"sorm/log"
)
const (
BeforeQuery = "BeforeQuery"
AfterQuery = "AfterQuery"
BeforeUpdate = "BeforeUpdate"
AfterUpdate = "AfterUpdate"
BeforeDelete = "BeforeDelete"
AfterDelete = "AfterDelete"
BeforeInsert = "BeforeInsert"
AfterInsert = "AfterInsert"
)
func (s *Session) ... |
867c73277f3dacc63159a38a6b71a578b69f0087 | 7167ea65f93f36ed6c0fa6cfe0a2be05725079ad | J1ng06/mp4ff | /bits/slicereader.go | Go | go | 4,632 | permissive | package bits
import (
"encoding/binary"
"errors"
"fmt"
)
var SliceReadError = fmt.Errorf("Read too far in SliceReader")
// SliceReader - read integers and other data from a slice.
// Accumulates error, and the first error can be retrived.
// If err != nil, 0 or empty string is returned
type SliceReader struct {
... |
bfbf36ebf0a94832755c8b67a8ad69de907a4f36 | cf23a1e291e2602b1a0518b8695d84cca6dd2f56 | kvaster/gitea | /routers/web/org/home.go | Go | go | 3,875 | permissive | // Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package org
import (
"net/http"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.... |
e0a092b806fe46e89675607522c8e73eb1d6c2fb | bbb19a599e81ea03cf5962b3bc667a2c37fb12a1 | nvx/nomad | /api/status_test.go | Go | go | 414 | permissive | package api
import (
"testing"
"github.com/hashicorp/nomad/api/internal/testutil"
)
func TestStatus_Leader(t *testing.T) {
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
status := c.Status()
// Query for leader status should return a result
out, err := status.Leader()
if err != nil {
... |
cc676c3a524758313d0906ab6ebc045aac36cb3c | db5b3e41dc8b56ed9694d75deba64a919d7856d3 | ShenMa/gf | /g/net/ghttp/ghttp_response.go | Go | go | 6,452 | permissive | // Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://gitee.com/johng/gf.
//
package ghttp
import (
"sync"
"net/http"
... |
55e803d803e5a264f50efe6928b9d5a0a824a97d | 40f0ff005e2b81d5f5fb2d4bee9cbe89e7da0fdd | atlassian/kubetoken | /cmd/kubetoken/main_test.go | Go | go | 1,631 | permissive | package main
import (
"reflect"
"testing"
)
func TestFilterRoles(t *testing.T) {
tests := []struct {
roles []string
filter string
keyWordsList []string
want []string
}{{
// special case
roles: []string{},
filter: ".",
keyWordsList: []string{},
want: []st... |
38cddeba37acdb0be4a2faa684d71c165051d8fe | c9f34284e39627fd9983cf28b360464192c7a965 | lioneagle/sip | /src/sipparser/SipHeaderContact.go | Go | go | 5,739 | permissive | package sipparser
import (
//"bytes"
//"fmt"
"unsafe"
)
type SipHeaderContact struct {
isStar bool
addr SipAddr
params SipGenericParams
}
func NewSipHeaderContact(context *ParseContext) AbnfPtr {
addr := context.allocator.Alloc(uint32(unsafe.Sizeof(SipHeaderContact{})))
if addr == ABNF_PTR_NIL {
return A... |
d5a2de961f22ed67830035c1f3a37f13ff9826f2 | 3c9c3a9b80d36b159ddbc61a38e84b254c38adbc | skowrons/kuma | /pkg/xds/envoy/listeners/v3/retry_configurer.go | Go | go | 3,167 | permissive | package v3
import (
"strings"
envoy_listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
envoy_route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
envoy_hcm "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
"github.com/gola... |
19fad64e359969ec8285d113b0e4c6eb80713b4d | 6f2c4ddc568f9ce7a3e77ccebbf5c81d3c1485c9 | svenjeppsson/go-hbci | /segment/basic_account_information.go | Go | go | 6,304 | permissive | package segment
import (
"github.com/mitch000001/go-hbci/domain"
"github.com/mitch000001/go-hbci/element"
)
type AccountInformation interface {
BankSegment
Account() domain.AccountInformation
}
//go:generate go run ../cmd/unmarshaler/unmarshaler_generator.go -segment AccountInformationSegment -segment_interface ... |
de8bf4bb438ee518cb76bd60aba3aeffb81aacde | 77dafc7d462a82073b8023c14ddf178d0e1ecf79 | Nolimit8/sms | /job/sms_templates.go | Go | go | 1,558 | no_license | package job
type DocumentsAwaitingPickupSMSTemplate int
const (
Day1 DocumentsAwaitingPickupSMSTemplate = iota
Day2
Day3
Day4
Day5
Day6
Day7
Day8
)
func (t DocumentsAwaitingPickupSMSTemplate) GetTemplate() string {
return [...]string{
"Ваш плакат прибыл в отделение почты: {{.ReferenceId}} 🚚 ",
"{{.Reci... |
67aab3b9f52bb88ff4161dfd62b487ab79116dc4 | 6139dbaecd81e8aaee4b676b7cd6b4a2dc60092e | AmarMundi/blockchain-samples | /contracts/industry/LogisticsSplit.0.6/Container/container.go | Go | go | 25,822 | permissive | package main
import (
"encoding/json"
"errors"
"fmt"
"strings"
"time"
// "reflect"
// "github.com/mcuadros/go-jsonschema-generator"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/util"
)
// These are common alerts reported by sensor. Example Tetis.
... |
f0e8d393d776d8b164700d92e756cc2ff14792ad | d00b240bcbef383c2909abd78d3241e5a2e322d9 | SvSerg/webapp | /events/events.go | Go | go | 576 | no_license | package events
// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com), kinosov
type Handler func(params ...interface{})
var events map[string][]Handler
func init() {
events = make(map[string][]Handler)
}
// Handle устанавливает обработчик Handler на событие name
func Handle(name string, handler Handler) {
events[name] =... |
e86505d42016841ee2b9026b71ecc04c742fc1aa | ab2790f4d4e7dc38cda490d3b81a4e3a339f0e79 | zeuxisoo/go-delega | /delega.go | Go | go | 586 | permissive | package delega
import (
"errors"
"github.com/zeuxisoo/go-delega/contract"
"github.com/zeuxisoo/go-delega/provider"
)
// Supported provider names
const (
FreeProxyLists = iota
XiCiDaiLi
)
// Return created provider by pass provider name
func Create(providerType int) (contract.Provider, error) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.