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
bdc08640192e735dc8732a4ea2567261cf229884
9496f85783f26143671c070b19a50ef16b4f2722
SealNTibbers/go-bitstream
/bitstream_test.go
Go
go
5,930
permissive
package bitstream import ( "bytes" "fmt" "io" "strings" "testing" ) func TestBitStreamEOF(t *testing.T) { br := NewReader(strings.NewReader("0")) b, err := br.ReadByte() if b != '0' { t.Error("ReadByte didn't return first byte") } b, err = br.ReadByte() if err != io.EOF { t.Error("ReadByte on empty ...
f77258e91ad99774430b987683e2652271c08b43
fa0a51911966f118e9789eeaee0a1aaff335816e
dolotech/gameserver
/src/config/sign_award_data.go
Go
go
320
no_license
package config //签到奖励 type SignAwardData struct { DropId int `json:"dropId"` //掉落id } var signAwardPool **SignAwardPool type SignAwardPool map[string]SignAwardData func SignAward() *SignAwardPool { return *signAwardPool } func (this *SignAwardPool) Get(id string) SignAwardData{ return (*this)[id] }
ff9817308d7adfc26a9ee6d846140095662b2865
c9b7e0654aae2a78685933b317dee1f3dfa651e5
marabunta/sandbox
/x509/csr/main.go
Go
go
1,501
permissive
package main import ( "crypto/ecdsa" "crypto/elliptic" "crypto/rand" "crypto/x509" "crypto/x509/pkix" "encoding/asn1" "encoding/pem" "fmt" "io/ioutil" "log" "os" "github.com/satori/go.uuid" ) func main() { key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { panic(err) } uui...
a9d98bd5dc23a67aeaf663c867fad42e70d3f8b0
b2e909aed47c1d3e4901dd68ac113964e2bb6625
Cellebyte/grafana-operator
/pkg/controller/model/adminUserSecret.go
Go
go
2,186
permissive
package model import ( "github.com/integr8ly/grafana-operator/v3/pkg/apis/integreatly/v1alpha1" v12 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "os" "sigs.k8s.io/controller-runtime/pkg/client" ) func getAdminUser(cr *v1alpha1.Grafana, current *v12.Secret) []byte { if cr.Spec.Config.Security =...
3836f73db1be6a260b94d8e192d383645258f887
5f1cb60e2f7c229125339975e9faf34d0b77c1d6
devsisters/binarydist
/bzip2.go
Go
go
2,866
permissive
package binarydist /* #cgo CFLAGS: -I/usr/include #cgo LDFLAGS: -L/usr/lib -lbz2 #include <bzlib.h> #include <stdlib.h> bz_stream* new_bz_stream() { return calloc(1, sizeof(bz_stream)); } void free_bz_stream(bz_stream* stream) { free(stream); } int bz_compress(bz_stream* stream, int action, char* in, unsigned a...
f30e14ab1bee6cfa1f634e5dda78af0cbc25471c
8756ae56e4a695d21b64ea11ccb8e7d0932490db
AlejandroLayos/startingGo
/src/conections/filmsService.go
Go
go
942
no_license
package conections import ( "encoding/json" "io/ioutil" "log" "net/http" "time" "github.com/AlejandroLayos/startingGo/src/model" ) //GetListOfFilms gets all the Films registered func GetListOfFilms() []model.Film { var films []model.Film spaceClient := http.Client{ Timeout: time.Second * 10, // Maximum of ...
6d9e15aa1727765283a9928c2f08f5ee5de62b04
d900404035850b23e8a32010c6435657def55d52
AndreasBurger/gardener
/pkg/admissioncontroller/webhook/auth/seed/graph/doc.go
Go
go
891
permissive
/* 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 applicable law or agreed to in writing, ...
bbeb8e8dfe647c6ff368e8a926255b917155f13c
b90d86b4579b9de76ddbd390d590c36b498eb846
gchange/subsurface-stream
/dialer/counter.go
Go
go
2,881
no_license
package dialer import ( "errors" "github.com/sirupsen/logrus" "net" "strconv" "time" ) type CounterConfig struct { Interval string `subsurface:"interval"` Dialer map[string]interface{} `subsurface:"dialer"` interval time.Duration dialerConfig Config } type Counter struct { *CounterConfig dialer Dialer ch...
16da741c2b483758b958fb2c528dc4af200751e4
d6ca9987e2eeaf032cf17aeb06e0eca5d26d98d5
alphagov-mirror/paas
/platform-tests/src/platform/vendor/github.com/concourse/atc/web/index/handler_test.go
Go
go
2,888
permissive
package index_test import ( "html/template" "io/ioutil" "net/http" "net/http/httptest" "code.cloudfoundry.org/lager/lagertest" "github.com/concourse/atc" . "github.com/concourse/atc/web/index" "github.com/concourse/atc/web/pipeline" "github.com/concourse/atc/web/webfakes" cfakes "github.com/concourse/go-con...
bdbe51dc0eaab637e7de3030cc91f52c5ac77d2f
4f694129da67dafcaf2602a1f7f1d37d15d00bac
AndyOsei/ultimate-go
/go/design/decoupling_4.go
Go
go
5,201
permissive
// ------------------------------------- // Decoupling With Interface Composition // ------------------------------------- // We change our concrete type System. Instead of using two concrete types Xenia and Pillar, we // use 2 interface types Puller and Storer. Our concrete type System where we can have concrete // b...
ad6d31af180654feaaf95616c36787bb2d4cd853
41b794a1ed4b4cb441c477082f679e8781a90985
lszymik/kyma
/tests/connector-service-tests/test/testkit/k8sClient.go
Go
go
1,845
permissive
package testkit import ( "fmt" "github.com/kyma-project/kyma/components/application-operator/pkg/apis/applicationconnector/v1alpha1" "github.com/kyma-project/kyma/components/application-operator/pkg/client/clientset/versioned" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/rand" restcli...
2c74d235710fe98144ff2c5e06a527d39e01137a
c945274777f84872bc28b237e483296995bef645
shammishailaj/streams
/sql/sink_test.go
Go
go
8,368
permissive
package sql_test import ( "database/sql" "errors" "testing" "github.com/msales/streams/v2" "github.com/msales/streams/v2/mocks" sqlx "github.com/msales/streams/v2/sql" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "gopkg.in/DATA-DOG/go-sqlmock.v1" ) func newDB(t *testing.T) (*sql.D...
759e914797cbc992804d591d00668c7ed4f59c57
1023a89de3a0a40f41bef8963c93745443c110bd
chenleijava/go-guava
/batch/batch_test.go
Go
go
2,173
no_license
package batch import ( "github.com/robfig/cron" "log" "sync" "testing" "time" ) /* select { case v1 := <-c1: fmt.Printf("received %v from c1\n", v1) case v2 := <-c2: fmt.Printf("received %v from c2\n", v1) case c3 <- 23: fmt.Printf("sent %v to c3\n", 23) default: fmt.Printf("no one was ready to communicate\n") }...
029d8ed2adc2f2c5d617f4b2ae69dca3720ff8c7
9e69f182d93d5fcf67355e30517ea30161f48034
Exabeam/felix
/ip/ip_suite_test.go
Go
go
1,233
permissive
// Copyright (c) 2017 Tigera, Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by appli...
b1560da04367c2ed56c7fdd6fa91cf87d5c3bc76
9577910a3461c6fd030223ecd097e41a5e9170ad
Desmonddai583/Notes
/Go/framework/gin/demo/gindemo2/src/TopicModel.go
Go
go
1,028
no_license
package src import "time" type Topics struct { //单个Topic实体 TopicID int `json:"id" gorm:"PRIMARY_KEY"` TopicTitle string `json:"title" binding:"min=4,max=20"` TopicShortTitle string `json:"stitle" binding:"required,nefield=TopicTitle"` UserIp string `json:"ip" binding:"ipv4"` TopicScore int `json:"score" binding:...
2c1879f85e5c64a6e4a369b655607cf5bf219aa8
db785dda2462a8fa1dca283ecef6f75f6ef9eb82
kedacore/keda
/vendor/github.com/montanaflynn/stats/geometric_distribution.go
Go
go
1,037
permissive
package stats import ( "math" ) // ProbGeom generates the probability for a geometric random variable // with parameter p to achieve success in the interval of [a, b] trials // See https://en.wikipedia.org/wiki/Geometric_distribution for more information func ProbGeom(a int, b int, p float64) (prob float64, err erro...
17e45ce053cc96a2098dc0a35a40ff901ddeb42e
dfbf013c18a5adcc16862c9cf5ff2e2387d6cb25
bjornleffler/google-api-go-client
/language/v1/language-gen.go
Go
go
86,485
permissive
// Copyright 2019 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 language provides access to the Cloud Natural Language API. // // This package is DEPRECATED. Use package cloud.google.com/go/language/a...
839e6b0c90dad898a0625a92d9f65c7643240b8c
381fb1ff9c7b0b8d70996e2649333386c98f2e8d
huagetai/painter
/textview.go
Go
go
3,173
no_license
package painter import ( "fmt" "github.com/huagetai/painter/utils/emoji" "math" "strconv" "strings" ) var emojiParser = emoji.NewEmojiParser() type TextView struct { X float64 Y float64 Width float64 LineHeight float64 LineClamp string Text string FontFamily string FontSize...
a4b85e1509b3ba427e9c2d49108b43ae4fac381c
4c306da847ebb772fb762d09e9077507b40ebb41
alanvoss/docker_sample_app
/my_app.go
Go
go
259
permissive
package main import ( "fmt" "os" "strings" ) func main() { for _, kvPair := range os.Environ() { splitUp := strings.Split(kvPair, "=") key, value := splitUp[0], splitUp[1] fmt.Fprintf(os.Stdout, "key: %s, value: %s\n", key, value) } }
08c2f4b6d599e4a3cbaf8c1e500dc63e31956f67
a42219a7377862e33f815b41959b1908bc63f790
pablogtzgileta/go-microservices-intro
/src/api/services/repositories_service.go
Go
go
1,404
no_license
package services import ( "github.com/pablogtzgileta/go-microservices-intro/src/api/config" "github.com/pablogtzgileta/go-microservices-intro/src/api/domain/github" "github.com/pablogtzgileta/go-microservices-intro/src/api/domain/repositories" "github.com/pablogtzgileta/go-microservices-intro/src/api/providers/git...
30d3fae8b29b9ece895c1241254913ddac0e158d
41e53a7e6083d141ba9881fb055aa8d8d1eb2128
davidpelaez/gh-keys
/Godeps/_workspace/src/github.com/stretchr/testify/suite/suite_test.go
Go
go
4,784
no_license
package suite import ( "errors" "github.com/stretchr/testify/assert" "io/ioutil" "os" "testing" ) // This suite is intended to store values to make sure that only // testing-suite-related methods are run. It's also a fully // functional example of a testing suite, using setup/teardown methods // and a helper me...
db7a76bfab6dd47dd2410af2453d4a672513b074
056d488455fd6a7dd93de94730fb7dfd4484b4c2
makiko-fly/peterstd
/cache/lru.go
Go
go
1,908
no_license
package cache import ( "container/list" "sync" ) var _ Cache = (*lruCache)(nil) type lruEntry struct { key interface{} value interface{} hits int64 } type LRUCache = *lruCache type lruCache struct { cap int fast map[interface{}]*list.Element ll *list.List lock sync.RWMutex onEvict func(...
2b395dd1438c533186e3ff26fb09549725dca436
623db66076631cb31e3da1d00a5354ffc651ad0c
munnerz/navigator
/pkg/client/clientset/internalversion/typed/navigator/internalversion/fake/fake_cassandracluster.go
Go
go
5,492
permissive
/* Copyright 2017 Jetstack Ltd. 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 d...
9e437bb5d7b3121013d833973a742e272947c937
3af9528c8acf1b4d04b6324237e885c87739b4d6
Shcarp/kingim
/channels.go
Go
go
1,066
no_license
package kingim import ( "kingim/logger" "sync" ) type ChannelMap interface { Add(Channel) Remove(id string) Get(id string) (Channel,bool) All() []Channel } type ChannelsImpl struct { channels *sync.Map } func NewChannels(num int) ChannelMap { return &ChannelsImpl { channels: new(sync.Map), } } func (ch ...
875cd7cc9b53531f0d44fd1e8bae438b450e61d0
b43ea47f0c63003418db157c0621b087539e1035
serodi/discord-stock-ticker
/utils/holders.go
Go
go
855
permissive
package utils import ( "fmt" "log" "net/http" "strings" "github.com/PuerkitoBio/goquery" ) const ( ChainURL = "https://%s/token/%s" ) func GetHolders(chain, contract string) string { var holders string switch chain { case "ethereum": chain = "etherscan.io" case "binance-smart-chain": chain = "bscscan...
ca267ebe19587e11cf3cc7bcf07356386188ef41
67a1051844634156060336d59becd8761f2ec360
bamishr/origin
/vendor/github.com/openshift/library-go/pkg/controller/factory/controller_context.go
Go
go
3,255
permissive
package factory import ( "fmt" "strings" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" "github.com/openshift/library-go/pkg/operator/events"...
029c5dc32c64448e854a4626eb8d166a3a512e1f
5499381f7f9d04cf75abc30a0651721734128f50
ryo628/isucon9-qualify
/cmd/payment/main.go
Go
go
397
permissive
package main import ( "log" "net" "net/http" "time" "github.com/isucon/isucon9-qualify/bench/server" ) func main() { liPayment, err := net.ListenTCP("tcp", &net.TCPAddr{Port: 5555}) if err != nil { log.Fatal(err) } pay := server.NewPayment(nil) serverPayment := &http.Server{ Handler: pay, } pay.Se...
7db516027fb745f07013f389c746dece3a2b4ac5
eff11a27765b79e412f32e2425b76cb979b8c32b
openshift/kubernetes
/openshift-kube-apiserver/admission/customresourcevalidation/route/defaulters_test.go
Go
go
1,881
permissive
package route import ( "fmt" "go/ast" "go/parser" "go/token" "io/fs" "strings" "testing" "k8s.io/apimachinery/pkg/util/sets" ) func TestDuplicatedDefaulters(t *testing.T) { expected, err := findDefaultersInPackage("../../../../vendor/github.com/openshift/library-go/pkg/route/defaulting") if err != nil { ...
d0c33b626d5d3a8c3b04b504444e67b38ec86d37
8ff771af080dfc309afe7aefcce019ee940686e7
openshift/assisted-service
/vendor/k8s.io/apiserver/pkg/server/options/authentication.go
Go
go
19,277
permissive
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
7248b33a868b10e84fe0ab40f932bfc407cadb8f
dd15f07ba61c424eab1126612fd070cd4c8ff9c7
libgolang/config
/int_flag.go
Go
go
306
no_license
package config import "flag" type intFlagDef struct { name string usage string valueDefault int valuePtr *int value int } func (f *intFlagDef) Flag() { f.valuePtr = flag.Int(f.name, envInt(f.name, f.valueDefault), f.usage) } func (f *intFlagDef) Resolve() { f.value = *f.valuePtr }
88efb34f46124829bb911da977798c04d0eae525
54ffe2217bab9257abd491d7104cca695a23f476
aneeshkp/cluster-network-operator
/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/events/log_events.go
Go
go
2,865
permissive
// Copyright 2018 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 ...
540ff8bef6d11309568e76d1cd1316630ac82b82
f880121c77a58ff50f43ee15c02a696fd6ad3dcc
shmsr/sourcegraph
/internal/cmd/search-blitz/main.go
Go
go
3,983
permissive
package main import ( "context" "math/rand" "net/http" "os" "os/signal" "path/filepath" "sync" "syscall" "time" "github.com/inconshreveable/log15" "github.com/prometheus/client_golang/prometheus/promhttp" "gopkg.in/natefinch/lumberjack.v2" ) const port = "8080" const envConfig = "CONFIG" const envLogDir ...
f5b0a600d083577a7dc0ed9ed38f78d2c5ecd7fd
498a84215490d5b5305335b6d6f8bb1af233d6eb
IfuryI/2021_1_kekEnd-1
/internal/ratings/usecase/usecase_test.go
Go
go
1,513
no_license
package usecase import ( "github.com/go-park-mail-ru/2021_1_kekEnd/internal/models" "github.com/go-park-mail-ru/2021_1_kekEnd/internal/ratings/mocks" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "testing" ) func TestReviewsUseCase(t *testing.T) { ctrl := gomock.NewController(t) defer ct...
35ce4c2a1e88581d1e5a8a523cdc1c375391a1af
005e3961fdd4153fe13e5c15cb1f3ae46c5c48a2
Necmttn/chainlink
/core/services/chainlink/application_test.go
Go
go
1,863
permissive
// +build !windows package chainlink_test import ( "syscall" "testing" "github.com/smartcontractkit/chainlink/core/internal/cltest" "github.com/smartcontractkit/chainlink/core/store/models" "github.com/onsi/gomega" "github.com/stretchr/testify/require" "github.com/tevino/abool" ) func TestChainlinkApplicati...
1b2da08900a6a2a2f005232a9c3374ca1716a155
3a7408727a4958143a6eb718e4616de1af7fb4dd
Stadicus/bitbox02-api-js
/gowrapper/cardano.go
Go
go
8,695
permissive
// Copyright 2021 Shift Crypto AG // // 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...
9d7069d3c018f4c9835ca709ab8aa4d08759046e
103a11f69718d45b0c4a7fc158fc72114651952c
iPolyomino/go-todo
/controller/task.go
Go
go
2,385
permissive
package controller import ( "encoding/json" "net/http" "github.com/voyagegroup/go-todo/model" "github.com/jmoiron/sqlx" ) // Todo はTodoへのリクエストに関する制御をします type Todo struct { DB *sqlx.DB } // GetはDBからユーザを取得して結果を返します func (t *Todo) Get(w http.ResponseWriter, r *http.Request) error { todos, err := model.TodosAll(...
747486b4b6cf404c0ea4bab8accb7c7d69cc5bf3
05efc33fa27e0ddf08b556da631860b1bf0df8f8
kulcsartibor/go-web
/web-app.go
Go
go
3,373
no_license
package main import ( "github.com/spf13/viper" "log" "./config" "flag" "net/url" "github.com/gorilla/mux" "github.com/gorilla/handlers" "net/http" "os" "time" "net/http/httputil" "strconv" "encoding/json" "sync" ) type GuiConfig struct { OraUrl string `json:"oraAddress"` OraPort int `json:"oraPort...
a2826bac3709615ef4c30ea3af9b452702bfd399
b57f909b08bba142cd1c3ef42e2e00f978afdf16
openacid/traft
/record.go
Go
go
1,254
permissive
package traft import ( fmt "fmt" "strings" ) // NewRecord: without Overrides yet!!! TODO func NewRecord(leader *LeaderId, seq int64, cmd *Cmd) *LogRecord { rec := &LogRecord{ Author: leader, Seq: seq, Cmd: cmd, } return rec } func NewRecordOverride(leader *LeaderId, seq int64, cmd *Cmd, override *...
a7a944a9ff10a22ef5bbce962d6df30bdec1a503
182ab0b980d799d35dccdeb82ef54a1fe0fd7856
regentropfenbinacs/linkchain
/types/tx_type_cct.go
Go
go
5,584
permissive
package types import ( "crypto/ecdsa" "fmt" "math/big" "sync/atomic" "github.com/lianxiangcloud/linkchain/libs/common" "github.com/lianxiangcloud/linkchain/libs/log" ) type ContractCreateMainInfo struct { FromAddr common.Address `json:"from" gencodec:"required"` // the Addr's signdata must be include in S...
11f95fd7c9eefa16184885fc5260cc25b69ecae2
b911938a584fed79ea45f186368e3127254228c8
nakkurt/forge
/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go
Go
go
36,400
permissive
package dockerfile2llb import ( "bytes" "context" "encoding/json" "fmt" "math" "net/url" "path" "path/filepath" "sort" "strconv" "strings" "github.com/containerd/containerd/platforms" "github.com/docker/distribution/reference" "github.com/docker/docker/pkg/signal" "github.com/docker/go-connections/nat"...
72a25d963033bff7887b752014cd3815dfe16bee
f324c5421e8d5138e7c420763c056a36ae0ff97c
kamiaka/go-validation
/error.go
Go
go
1,120
permissive
package validation import ( "bytes" "fmt" ) // Errors is an array of Error. type Errors []Error func (e Errors) Error() string { buf := bytes.NewBufferString("Validation error.") for i := 0; i < len(e); i++ { buf.WriteString("\n") buf.WriteString(e[i].Error()) } return buf.String() } // Error is validat...
705c50f25bfbd57b785f8561f1b153c2264c85ed
d9c0ab154acf429bc2729d6bea04088d964bb178
kalbasit/packet-loss-monitor
/main.go
Go
go
1,430
no_license
package main import ( "flag" "fmt" "log" "os" "github.com/sparrc/go-ping" ) var ( host string ) func init() { flag.StringVar(&host, "host", "", "the hostname to ping") } func main() { flag.Parse() if host == "" { log.Print("a hostname is required") flag.Usage() os.Exit(1) } pinger, err := ping.Ne...
17b167aea1e18aef3352d3981f1c3a01bafe1142
10ab2e39a484e14da17d64df81688a4731dbd8f0
Volland/sidetree-core-go
/pkg/versions/0_1/txnprovider/models/coreproof.go
Go
go
1,707
permissive
/* Copyright SecureKey Technologies Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package models import ( "encoding/json" "github.com/pkg/errors" "github.com/trustbloc/sidetree-core-go/pkg/versions/0_1/model" ) // CoreProofFile defines the schema for core proof file. Core proof file contains...
f9a7f2bafa49b4aedf497131db20a15db1ed1628
34879e5f4d2971899f5122be0f40d3a1fb87c18e
hugmatj/oci-go-sdk
/dts/list_appliance_export_jobs_request_response.go
Go
go
6,194
permissive
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei...
f486a41f51f560f34145a81b3c34274e7ddad015
1ac86ea32c6f8e167583458093f8acf0799391fb
kaidev1024/leetcode-golang
/lc_problems/medium/lc0396_RotateFunction/main.go
Go
go
332
no_license
func maxRotateFunction(nums []int) int { n := len(nums) if n == 1 { return 0 } sum := 0 r := 0 for i, v := range nums { sum += v r += i * v } result := r for i := n - 1; i >= 0; i-- { r += sum - nums[i]*n result = max(result, r) } return result } func max(a, b int) int { if a > b { return a }...
38078c0f9cb249d055fb41c71be369e3180de22e
d78ebe2858bceddaefc3e7d745e8b8ff972c0560
digitalbitbox/bitbox-wallet-app
/vendor/github.com/ethereum/go-ethereum/rpc/endpoints.go
Go
go
1,785
permissive
// Copyright 2018 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License...
edc3a35002a2eb427a3501491f140c267a0d411d
819b30785237d27a730b5b679f040b5bca71d2d2
YuchaoZheng/kmr
/examples/ch_wash/main.go
Go
go
2,962
no_license
package main import ( "bytes" "regexp" "strings" "unicode" "github.com/naturali/kmr/executor" kmrpb "github.com/naturali/kmr/pb" ) const ( WasherSplitPuncts = `,|\.|!|\?|,|。|!|?|:|:|;|;|「|」|.|\t|:…{}` WasherIgnorePuncts = "  '\"《》‘’“”・-_<>〃〈〉()()……@、【】[]*-、『』~" ) var ( ignorePuncts map[rune]bool splitPun...
2d01f1731eba26efb16e20e270c965cc7c4913bc
40e53fa63569b65cbae9ebcc78e772d9c26d071d
little-cui/service-center
/client/client.go
Go
go
1,315
permissive
// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not...
31e60977b6dd6035a5a768145c919033317ec56b
a1ae33adfda9c1877c09eb975926a249ce0ada46
amitsaha/ec2-fzf
/vendor/github.com/solarnz/fzf/src/core.go
Go
go
7,583
permissive
/* Package fzf implements fzf, a command-line fuzzy finder. The MIT License (MIT) Copyright (c) 2016 Junegunn Choi 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 ...
ad34ca1d030e8f45e865b2523fedd0597fae08a3
7f72fe9034ed53941e9624d503cf6faaa961fab6
MatiasLyyra/JabaScript
/parser/parser.go
Go
go
4,796
permissive
package parser import ( "fmt" "strconv" "github.com/MatiasLyyra/JabaScript/lex/token" ) type parser struct { tokens []token.Token idx int } func (p *parser) peek() token.Token { if p.idx >= len(p.tokens) { return token.Token{Kind: token.EOF} } return p.tokens[p.idx] } func (p *parser) peekAt(offet int)...
16c95842618172160150f0fc2cfd948c788b2451
9b7a1071ef71c7fe857693eb7d15319c5a5ec08e
Mattlk13/oci-go-sdk
/datacatalog/create_job_definition_details.go
Go
go
2,860
permissive
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei...
1236700889b6bc6691c39a3adecddaa05f53b437
8c59a30672be3fbd32583472beda9beb24763316
iiwawe/test-go
/testLVM/lvmMsg.go
Go
go
2,776
no_license
package main import ( "encoding/json" "fmt" "github.com/CodisLabs/codis/pkg/utils/log" "github.com/google/lvmd/parser" "os/exec" "strconv" "strings" ) const separator = "<:SEP:>" func main() { //[]*parser.LV //lvs, err := ListLV("vg-k8s") vg, err := GetVg("centos") if err != nil { log.Error(err) retur...
4d5bfb774506f57465153ab96965960280749dc3
9f649d7eeb6172188965264702b337d633140528
sensu/sensu-go
/cli/commands/check/info_test.go
Go
go
2,293
permissive
package check import ( "errors" "testing" v2 "github.com/sensu/core/v2" client "github.com/sensu/sensu-go/cli/client/testing" test "github.com/sensu/sensu-go/cli/commands/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestInfoCommand(t *testing.T) { assert := asser...
0c92fc6bd2c349d73f27681b65c10157934edb00
31fd9621a82aea6b7000b4e84443ac7202efdbf0
kudzu-sh/kudzu
/cluster.go
Go
go
1,568
permissive
// Copyright © 2018 the Kudzu contributors. // Licensed under the Apache License, Version 2.0; see the NOTICE file. package main import ( "net/url" "os" "go.uber.org/zap" kingpin "gopkg.in/alecthomas/kingpin.v2" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/cl...
fa2ab1fa951dc6b53b72cacde4f3d81aa67615e9
3db9edb2fded4cd5d5b9e6cb6c56bd4b9fd29762
nelkinda/http-go
/mimetype/scraper/scraper.go
Go
go
2,005
permissive
package main import ( "fmt" "github.com/antchfx/xmlquery" "github.com/iancoleman/strcase" "os" "regexp" ) var format = ` // %s is the constant for the mime type "%s". %s = "%s" ` var re = regexp.MustCompile("[/+-.]") func main() { url := "https://www.iana.org/assignments/media-types/media-types.xhtml" if d...
dff011bf8f242724de50c3f76d6bf04f26f82c92
6a012518f69e2cb313d13074dfe13df5781567f8
winrarr/LoM-api-2
/main.go
Go
go
1,096
no_license
package main import ( "LoM-api/oauth2" "LoM-api/sessions" "encoding/json" "io/ioutil" "log" "os" ) type Keys struct { CLIENT_SECRET string CLIENT_ID string RIOT_API_KEY string TWITCH_CLIENT_ID string TWITCH_CLIENT_SECRET string PATCH string SEASON ...
fe484dc4013e184ca7a31b721a526ce9ff68f4a0
bd17fa767f3f6c99083fec58eac1dde2ca0837fd
runnan/helloworld_web
/app/model/user.go
Go
go
855
no_license
package model import ( "golang.org/x/crypto/bcrypt" "github.com/badoux/checkmail" "helloworld_web/app/util" ) type User struct{ Username string Email string HashedPassword string ID string } const ( passwordLength = 6 hashCost = 10 ) func NewUser(username, email, password string) (User, error){ u...
36c6b4c0b42d35ce7136ca3af907fbb86fe13d3f
301c5740392e42df185d3bbe729e81ac620e278b
ertprs/api-services
/src/trustcloud/check/full_contact_company_check.go
Go
go
4,444
no_license
package check import ( "database/sql" "encoding/json" "fmt" "io/ioutil" "net/http" "strconv" "strings" "time" "trustcloud/api" "trustcloud/util" ) /* INFO: 2015/04/13 13:43:23 full_contact_company_check.go:129: body : { "status" : 404, "message" : "Searched within last 14 days. No results found for thi...
8ca88c0777c1788589fff9bb26462e7b8f0ee8e8
8025dc7fb192cc1572920a987a36d7435ca8239a
akensho/comp_golang
/atcoder/abc/087/a.go
Go
go
1,169
permissive
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) var ( in = bufio.NewReader(os.Stdin) out = bufio.NewWriter(os.Stdout) MOD = 1e9 + 7 UMOD = uint64(1e9 + 7) factorial []uint64 inverse []uint64 ) func main() { x := intv() a := intv() b := intv() res := x - a - ((x...
fb5aa1e1b62b744491eadd3a9bc7ff924e192720
750c0b7f4a0ee3e97c4b29bf3b83725797c04d98
alexandrepiveteau/go-raytracing
/pkg/hit/material.go
Go
go
203
no_license
package hit import ( "raytracing/pkg/color" "raytracing/pkg/geom" ) type Material interface { Scatter( ray geom.Ray, record *Record, attenuation *color.Color, scattered *geom.Ray, ) bool }
db7fed8f01f657ed33a47bcf511b7a110652ce09
8cb031da7e71a4cd1dbf37604af9db12b3df8a89
mhchia/go-libp2p-daemon
/p2pclient/streams.go
Go
go
4,462
permissive
package p2pclient import ( "bytes" "encoding/binary" "fmt" "io" "net" ggio "github.com/gogo/protobuf/io" "github.com/gogo/protobuf/proto" pb "github.com/libp2p/go-libp2p-daemon/pb" peer "github.com/libp2p/go-libp2p-peer" ma "github.com/multiformats/go-multiaddr" ) // StreamInfo wraps the protobuf structure...
4480aa2c5247c66134af841a36279f6dfc0c0028
8af401d3584b1e717ca3a5ca915c6609409dfbd2
yansal/requestr
/internal/broker/redis.go
Go
go
1,739
no_license
package broker import ( "context" "time" "github.com/go-redis/redis" "github.com/pkg/errors" ) type RedisPublisher struct { redis *redis.Client } func NewRedisPublisher(redis *redis.Client) *RedisPublisher { return &RedisPublisher{redis: redis} } func (b *RedisPublisher) Publish(ctx context.Context, queue str...
b1e92c397e6ee1d2ae050cd81511514f6b391308
9e6a3782d52f6b730737977162e2d3c775dc81eb
tukoyi/Leetcode
/1. Two Sum/solution-hash.go
Go
go
337
no_license
func twoSum(nums []int, target int) []int { var result []int var hstab = make(map[int]int) var v int for k, v := range nums{ hstab[v] = k } for i, j := range nums{ v = target - j mapv, ok := hstab[v] if ok && i != mapv { result = append(result, i, hstab[v]) return result } } r...
99c69d584dd3a5b654cd30773a3bd739355b4c4f
754cff66affffe3b31b2b589f11a820a26da541f
fossabot/noah
/db/util/leaktest/leaktest.go
Go
go
3,357
permissive
/* * Copyright (c) 2019 Ready Stock * * 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...
8496e561ac3f98d9e6a28d00fc773fc18caa3020
1b45f04e1ec00b909aba59e4ffa1eee2855d3a2c
zeromem/query
/value/value.go
Go
go
11,685
no_license
// Copieright (c) 2014 Couchbase, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in ...
11ec932ccb3f6844d10a4d55a2155f0e03fb2a19
6a3ff03bfb4be0bf63254473660e24a322fc3ef7
rafaelaraujobsb/estudo-golang
/arrays_slice_map/arrays_range/range.go
Go
go
221
no_license
package main import "fmt" func main() { numeros := [...]int{1, 2, 3, 4, 5} for i, numero := range numeros { fmt.Printf("%d) %d\n", i, numero) } for _, numero := range numeros { fmt.Printf("%d\n", numero) } }
cc21ec5fd8e26776a7e755d715854001f3dca31b
af668f3b2b4b026df822b88c3fa494b642f2159e
lflxp/study
/templateMethod/StringDisplay.go
Go
go
583
no_license
package templateMethod type StringDisplay struct { st string width int } func (this *StringDisplay) StringDisplay(ch string) { this.st = ch this.width = len(this.st) } func (this *StringDisplay) printLine() { print("+") for i:=0;i<this.width;i++ { print("-") } println("+") } func (this *StringDisplay)...
a9df6f5b961657cde04ae2d20df939dd4732d1db
a277b67b0bf1d8080d47f788003ca88aa894b2e4
Jacalz/fyne
/theme/icons_test.go
Go
go
13,369
permissive
package theme import ( "fmt" "path/filepath" "testing" "github.com/stretchr/testify/assert" "fyne.io/fyne/v2" ) func init() { fyne.SetCurrentApp(&themedApp{}) } func helperNewStaticResource() *fyne.StaticResource { return &fyne.StaticResource{ StaticName: "content-remove.svg", StaticContent: []byte{ ...
c1e3656688032e6ed4ffed2244a90a2e8f3ce41c
8418b044c004cf458048ecf2bd7d171d656fe0fd
yudaprama/iso20022
/model/Repartition2.go
Go
go
963
permissive
package model // Indicates how the amount of the investment plan is split amongst the funds. type Repartition2 struct { // Percentage of amount invested in a funds. Percentage *PercentageRate `xml:"Pctg"` // Security that is a sub-set of an investment fund, and is governed by the same investment fund policy, eg, ...
613d31a5fb710a6132079c1d14e75b4c42c90f76
47e995ad0cbf18e453566feba1a088bc1feb9f5f
liveactionsteve/jack
/processLines.go
Go
go
686
no_license
package jack import ( "bufio" "fmt" "os" "strings" ) func trimLine(line string) string { commentIdx := strings.Index(line, "//") if commentIdx >= 0 { line = line[0:commentIdx] } line = strings.TrimSpace(line) return line } func ForLinesInFile(filename string, processLine func(line string, lineno int, orig...
c33f7adffeb37780adbf209c73f41d1bc60f38e1
8716090a85cc8df8fe8afa7336a2b966eae649fe
fuku2014/cert-manager-webhook-nifcloud
/main_test.go
Go
go
682
permissive
package main import ( "os" "testing" "github.com/jetstack/cert-manager/test/acme/dns" ) const ( KubeBuilderBinPath = "kubebuilder/bin" ManifestPath = "testdata/nifcloud" ) var ( zone = os.Getenv("TEST_ZONE_NAME") ) func TestRunsSuite(t *testing.T) { // The manifest path should contain a file named con...
4851493458cd05d1aefbe9544727750c51ca9a72
a75e9dd1b2766e9e878e8b053511ccd481ed6181
little-cui/service-center
/datasource/etcd/sd/servicecenter/syncer_test.go
Go
go
6,008
permissive
// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not...
0801c3daf09704f8863ea04e4d9f06d946e8f986
16a1baf0c5714a4add6990095edf37648ad113f9
dageita/frontend-websocket
/vendor/github.com/containerd/containerd/lease.go
Go
go
1,440
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 ...
319f9c5ed482d32d189f1777c0c8487c23c06bf2
68a1e398fd828c58a405005cd7d84d129d29df57
who0sy/Wache
/core/wache.go
Go
go
1,343
no_license
package core import ( "fmt" "log" "sync" ) var ( mu sync.RWMutex groups = make(map[string]*Group) ) // A Getter loads data for a key. type Getter interface { Get(key string) ([]byte, error) } // A GetterFunc implements Getter with a function. type GetterFunc func(key string) ([]byte, error) // Get implem...
ae4ca010878e972bc4406a6cdd2f0be8730fe44c
bdb91434d3ddfe6c22ecb58fa1944e75c7124286
wolffcm/flux
/stdlib/internal/promql/empty_table.go
Go
go
3,139
permissive
package promql import ( "fmt" "time" "context" "github.com/wolffcm/flux" "github.com/wolffcm/flux/execute" "github.com/wolffcm/flux/memory" "github.com/wolffcm/flux/plan" "github.com/wolffcm/flux/semantic" "github.com/wolffcm/flux/values" "github.com/pkg/errors" ) const EmptyTableKind = "emptyTable" type...
69789afca4b704bafe205bbb6bd729b35b4d7e63
aeab5a92a81a376fdff0da3be9e75a99280b997b
Julian-Chu/advanced-go-training-homework
/week4/todo/internal/data/data.go
Go
go
500
permissive
package data import ( "github.com/go-kratos/kratos/v2/log" "github.com/google/wire" "todo/internal/conf" ) // ProviderSet is data providers. var ProviderSet = wire.NewSet(NewData, NewTodoRepo) // Data . type Data struct { todoStore *InMemoryTodoStore } // NewData . func NewData(c *conf.Data, logger log.Logger) ...
31b1646b629822615f0b164c4ebd9065f4833a43
a36dfbf7b7f6dda3aa60fe4da577cff59ff320fc
recruit-tech/dicon
/mock_generator_test.go
Go
go
5,505
permissive
package dicon import ( "bytes" "testing" "go/ast" "github.com/andreyvit/diff" ) func TestMockGenerator_AppendMockStruct(t *testing.T) { t.Run("Simple case", func(t *testing.T) { ex := pretty(t, []byte(`type TestInterfaceMock struct { TestFuncMock func(a0 Arg1, a1 Arg2) Ret1 } func NewTestInterfaceMock(...
c70d20b008221cff491f541e050d2ccefb095cf4
16d8c804807afb4e21bd418cfbd6f6b39a751736
Ghost-ai-cpu/testkit
/printblocktime/main.go
Go
go
622
permissive
package main import ( "fmt" "os" "time" "github.com/tendermint/tendermint/libs/log" "github.com/smartbch/smartbch/staking" ) func main() { if len(os.Args) != 4 { fmt.Printf("Usage: %s <rpc-url> <username> <password>\n", os.Args[0]) return } rpcURL := os.Args[1] username := os.Args[2] password := os.A...
a9b0f0e58b1d88b77b0680f5804ba2780ff9a48c
a45188aba6949339023d92378ca931b04497e4ff
mxyue/start-go
/src/utils/lang/time_test.go
Go
go
221
no_license
package lang import ( "fmt" "testing" ) func TestGetTodayZeroTime(t *testing.T) { fmt.Println("GetTonightZeroTime()->", GetTonightZeroTime()) fmt.Println("GetTonightZeroTimestamp()->", GetTonightZeroTimestamp()) }
c88d187fc60fa3bd3ec5816bf96f6e52110c394c
b45dca98afb530832b2e61d19a5f08dac4ce38aa
jackzampolin/ibc-go
/modules/apps/transfer/types/msgs.go
Go
go
2,556
permissive
package types import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types" host "github.com/cosmos/ibc-go/modules/core/24-host" ) // msg types const ( TypeMsgTransfer = "transfer" ) // NewM...
2c718b99c746c114f1d79ba0e9f80791ac6e4f66
6cf5adbc6bdce85b8555b878ea7271e2b2d49e7c
hewerton-lvieira/URI-ONLINE-JUDGE
/quadradoPares/quadradoPares.go
Go
go
212
no_license
package main import ( "fmt" "math" ) func main() { var n int fmt.Scanln(&n) for i := 1; i <= n; i++ { if i%2 == 0 { temp := math.Pow(float64(i), 2) fmt.Printf("%d^2 = %v\n", i, int(temp)) } } }
b13e70b089cb253a13fc85d062fd9237d72c4ef5
bd6bfb85c808068f00e0bcc1dd14697d907822a1
appditto/pippin_nano_wallet
/libs/utils/validators_test.go
Go
go
529
permissive
package utils import ( "testing" "github.com/stretchr/testify/assert" ) func TestValidate64HexHash(t *testing.T) { valid := "1A2E95A2DCF03143297572EAEC496F6913D5001D2F28A728B35CB274294D5A14" assert.Equal(t, true, Validate64HexHash(valid)) // invalid, not hex invalid := "1A2E95A2DCZ03143297572EAEC496F6913D5001D...
5ae837f16208b0b8968d18b1524fa278a7ce7e91
0f8ae0ffcc44f07ced243f84f3f0570a4e669692
simongarisch/golang_stuff
/sync_mutex.go
Go
go
804
no_license
package main import ( "fmt" "sync" "time" ) // SafeCounter is safe to use concurrently. type SafeCounter struct { v map[string]int mux sync.Mutex } // Inc increments the counter for the given key. func (c *SafeCounter) Inc(key string) { c.mux.Lock() // Lock so only one goroutine at a time c...
85ef625cefd3a732db58f51730f9da793ac86c56
21f36f0a49199976985d9045a93be8bdcdfeaa20
JohnGrime/BarcodeCache
/Server/SQL.go
Go
go
7,407
no_license
package main import ( "database/sql" "fmt" "log" "os" "strings" _ "github.com/go-sql-driver/mysql" _ "github.com/lib/pq" _ "github.com/mattn/go-sqlite3" ) // Simple translation layer to allow some common vanilla SQL // routines to be used in a number of databases. Main difference // is the syntax for variabl...
a304b9a28a1852f7939424e1d5d552ff6e334f57
74294cfb42363ffa2f93a8cfa35ad05e61d98a8e
smills2929/gosnmp-python
/src/gosnmp_python/session.go
Go
go
16,136
permissive
package gosnmp_python import ( "encoding/json" "fmt" "math" "strings" "time" "github.com/ftpsolutions/gosnmp" "log" "os" "strconv" ) const ( usmStatsBaseOID = ".1.3.6.1.6.3.15.1.1" ) var usmStatsLookup = map[string]string{ ".1.3.6.1.6.3.15.1.1.1.0": "usmStatsUnsupportedSecLevels", ".1.3.6.1.6.3.15.1.1.2...
40e0db3ad2fc529ca4ccfa083d7d09d7f6aeae3a
9fba7f33cc0f90d5668c0fcc65654aa54b5c2020
daverigby/indexing
/secondary/indexer/memdb_slice_impl.go
Go
go
61,307
permissive
// Copyright (c) 2014 Couchbase, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writin...
929e70c93c392022615df1ec96d32865ca87c3ae
9513243405ad832975509ae41dd60d4eb104cfd1
radanalyticsio/oshinko-cli
/vendor/github.com/openshift/origin/pkg/cmd/server/crypto/extensions/extensions.go
Go
go
481
permissive
package extensions import ( "encoding/asn1" ) // oid is a helper function for concatenating OIDs func oid(o asn1.ObjectIdentifier, extra ...int) asn1.ObjectIdentifier { return asn1.ObjectIdentifier(append(append([]int{}, o...), extra...)) } var ( // RedHatOID is the IANA assigned ObjectIdentifier for Red Hat Inc....
c6116030151591f15bb5df3f8bd23b0136f86e6a
247345012842bf7fdac021e045fb5b77a68b37ec
AlekseySirmais7/test_task_advertising
/internal/adsPost/usecase/usecase_test.go
Go
go
4,695
no_license
package usecase import ( "errors" "github.com/stretchr/testify/require" "strconv" "strings" "test_task_advertising/internal/adsPost/constants" "test_task_advertising/internal/adsPost/mocks" "test_task_advertising/internal/errorsConst" "test_task_advertising/internal/models" loggerZap "test_task_advertising/in...
b60f1d60502e7908f5ee78e868e662c6f0f4556a
313588bdc532c4999075bac08d9cb8b6aa2cdc6f
RakhithJK/magma
/symphony/graph/authz/policies.go
Go
go
8,389
permissive
// Copyright (c) 2004-present Facebook All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package authz import ( "context" "fmt" "github.com/facebookincubator/symphony/graph/ent" "github.com/facebookincubator/symphony/graph/ent/permissions...
62b292e3560fb568f9ba36fee6ac4f7f85cb022e
01427f80e2e26a8fbf364929f4e46193b47a0785
novav/SimonJVM
/src/jvmgo/ch11/instructions/extended/ifnull.go
Go
go
614
no_license
/* 5.11.2 ifnull和ifnonnull指令 xinxin.shi 2017-06-22 23:13:37 */ package extended import "jvmgo/ch11/instructions/base" import "jvmgo/ch11/rtda" // Branch if reference is null type IFNULL struct{ base.BranchInstruction } func (self *IFNULL) Execute(frame *rtda.Frame) { ref := frame.OperandStack().PopRef(...
047b08332b3c32b345dad6b37cec4cd790111a1b
2331a84ba97b71e9267e1918290ded6604b5f768
zieg8301/rook
/pkg/operator/ceph/object/rgw.go
Go
go
8,789
permissive
/* Copyright 2016 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to ...
805a6102341ca238cd49ce61b3dff0e0dad129b3
dc10fe54064c8b8767441d9df911580d34d59a3f
tonyespy/device-sdk-go
/internal/handler/command.go
Go
go
26,217
permissive
// -*- Mode: Go; indent-tabs-mode: t -*- // // Copyright (C) 2017-2018 Canonical Ltd // Copyright (C) 2018-2020 IOTech Ltd // // SPDX-License-Identifier: Apache-2.0 package handler import ( "bytes" "encoding/base64" "encoding/binary" "encoding/json" "fmt" "math" "strconv" "strings" "sync" "time" "github.c...
9ef03cf607ff9c380557754866a667311b8dec15
9a9c7a2c423a23381d7e6478cbdc04750f90fc7e
xiongyejun/xyjgo
/hash/hash.go
Go
go
1,946
no_license
// hash <hashType> <src> <[check hash]> // 计算文本\文件的hash值 // <src> 先判断是否存在这个名称的文件,如果存在就计算文件的hash // <[check hash]> 如果输入了第4个参数,最后进行hash值的判断 package main import ( "crypto/md5" "crypto/sha1" "crypto/sha256" "fmt" "hash" "io/ioutil" "os" "strings" "github.com/xiongyejun/xyjgo/colorPrint" ) func main() { fmt.Pr...
abab2b28ea3b3137c949020c4c87efb4084e3aa7
776a4252ee3b547253d1d4bd673629ccda72e1e5
vickleford/kuby
/httpclienttest/spy.go
Go
go
904
no_license
package httpclienttest import ( "io/ioutil" "net/http" "strings" ) // TransportSpy spies on http client requests and records them for testing. // This will get moved out to a whole new project later. type TransportSpy struct { Request *http.Request response *http.Response Err error } func (t *TransportSp...
baaa19166d6d14d718b1ce1c4497bb2ccd5a6d0e
6d8415760c0ae0ca3278882eae4f2b2ca73dbcd3
Victor515/goLearning
/http/client.go
Go
go
928
no_license
package main import ( "net/http" "net/http/httputil" "fmt" ) func main() { // visit mobile site req, err := http.NewRequest(http.MethodGet, "http://www.imooc.com", nil) //req.Header.Add("User-Agent", // "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11....
284c8646d60084426888e6c3bae966064b32da8f
32d01037dc1d715581b79645e49966b365a9f701
epopoeia/jvm
/classfile/member_info.go
Go
go
1,856
no_license
package classfile /* field_info { u2 access_flags; u2 name_indes; u2 descriptor_index; u2 attributes_count; attribute_info attributes[attributes_count] } method_info{ u2 access_flags; u2 name_index; u2 ...
07b9a2b366c1f571541b7c0991fb97e1d22eef7e
3f78123e53d5add0f020aee13c432a1c0e6d9268
brownjasonj/udemy-go-course
/evenandodd/main.go
Go
go
247
no_license
package main import "fmt" func main() { sliceOfNumbers := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} for _, num := range sliceOfNumbers { if num%2 == 0 { fmt.Printf("%v is even\n", num) } else { fmt.Printf("%v is odd\n", num) } } }
9300dd58b8fff5f15d7e8b8f207b8043bea9eef1
d36cce0bb3cf1c6c105f5f9b348462a95eebeac6
CapitanShinChan/gopacket
/layers/base_test.go
Go
go
1,058
no_license
// Copyright 2012, Google, Inc. All rights reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file in the root of the source // tree. // This file contains some test helper functions. package layers import ( "github.com/CapitanShinChan/gopacket" "testing"...
7f12b01efa68ba6e9c66a931f6af66fc8c100585
0259a81122fa019f4ce6c71364906bfbb9a6c8d6
vaikas/acme-serverless
/shipment.go
Go
go
2,064
permissive
package acmeserverless import "encoding/json" // ShipmentRequested is the event sent by the Order service when the order is finalized and paid and // thus ready to be shipped to the customer type ShipmentRequested struct { // Metadata for the event. Metadata Metadata `json:"metadata"` // Data contains the payload...
c56faec7409fb5ae00105763bbacad2a47124c52
e85d7e99f002c1ed925dfdb42b6147def26b8674
groonga/grnci
/v2/response.go
Go
go
765
no_license
package grnci import ( "time" ) // Response is the interface of responses. type Response interface { // Start returns the server-side start time of the command if available. // Responses of HTTPClient may return a valid (non-zero) time. Start() time.Time // Elapsed returns the server-side elapsed time of the co...