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
1a7e3b664c80bf8fb2516b6ab4a3f5e4c62800b0
692cc7cf10ea814937cf552d67fba924c43157d1
busizshen/gin-sample-mysql-session
/api/v1/root/main.go
Go
go
381
no_license
package root import ( "net/http" "github.com/gin-gonic/gin" ) func GET(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"method": "GET"}) } func POST(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"method": "POST"}) } func PUT(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"method": "PUT"}) } func DELETE(c *gin.C...
dda025e85fb91b17c5b31bf65b79120c2d361372
f92e78bc67131cd7495682fff80c1ab839702a7d
K1ola/penguins_auth
/main.go
Go
go
904
no_license
package main import ( db "auth/database" "auth/helpers" "auth/models" "net" "github.com/spf13/viper" "google.golang.org/grpc" ) func setConfig() string { viper.AddConfigPath("./configs") viper.SetConfigName("config") var port string if err := viper.ReadInConfig(); err != nil { port = ":8083" SECRET = [...
e096a4bdd0b547232a67aa3392c16832cd294218
22ca7b5d7c2c03b21d01876f5f58bf71280660aa
txiaozhe-renamed/go-demo
/select/main.go
Go
go
1,895
no_license
/* * MIT License * * Copyright (c) 2017 SmartestEE 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, ...
99ffe1fc7b14af992bbfc4b701d5d13d3f04cd89
e4d74b44814163f6de51288d391b163879b658f7
shrhdk/gopl
/ch12/ex12/params/params.go
Go
go
2,900
no_license
package params import ( "bytes" "fmt" "net/url" "reflect" "strconv" "strings" ) // Pack encode value to URL query parameter string func Pack(v interface{}) string { val := reflect.ValueOf(v) if val.Kind() != reflect.Struct { return "" } var buf bytes.Buffer for i := 0; i < val.NumField(); i++ { field ...
93055062033b4669f0ca15d939b5f0db54f87765
894e070a5b62d9d7b07835828c0a81ccd6cb9f4e
mehrdad-shokri/drone
/handler/api/repos/secrets/none.go
Go
go
1,359
permissive
// Copyright 2019 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 required by applicable law or agreed to...
0a5362199b6dc85cd03a2cc39b8d537a6bdebaf8
848617b6fd577e3623f0fcd12c6010c9f9b354c2
DualVectorFoil/Mario
/model/profileInfo.go
Go
go
426
no_license
package model import "github.com/jinzhu/gorm" type ProfileInfo struct { gorm.Model PhoneNum string `gorm:"not null;index:idx_phone_num"` AvatarUrl string UserName string `gorm:"not null"` Locale string Bio string Followers int32 Following int32 ArtworkCount int32 PWD ...
ef3e009f9fc1424dfa64bf06ce11d2ca3fcc269a
fc86300e2c8cdfd79f704fa9a9cb01a70ced95b1
jonanon/terraform-provider-openapi
/openapi/openapi_client.go
Go
go
10,530
permissive
package openapi import ( "fmt" "log" "net/http" "runtime" "strings" "github.com/dikhan/terraform-provider-openapi/openapi/version" "github.com/dikhan/http_goclient" ) type httpMethodSupported string const ( httpGet httpMethodSupported = "GET" httpPost httpMethodSupported = "POST" httpPut httpMeth...
295fdc872f0b01e5f241289c61050e341a15735e
ba432721c88872cd907687dec1b552b21beb22e9
mcanthony/shipshape
/shipshape/util/delimited/delimited.go
Go
go
3,905
permissive
/* * Copyright 2014 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicabl...
204ddd878a4a8d9c2a1c82f27344ae0d9c219de6
b7840f33eefa4491b221cfba34bd24bf0d5ea6ac
lingdecong/nsqueue
/producer/producer_test.go
Go
go
2,320
permissive
package producer import ( . "github.com/smartystreets/goconvey/convey" "testing" ) var ( topic = "producerTestTopic" destNsqdTCPAddr = "127.0.0.1:4150" ) func TestPublish(t *testing.T) { Convey("Given a json message to publish", t, func() { Convey("It should not produce any error", func() { Conne...
529d855cfae84f1f17d0b935506a995e077df2ac
adee4701d29f0020fd23a1a9cb3a2add510e5429
bmc-toolbox/redgopher
/openapi/model_operation.go
Go
go
484
no_license
/* * Redfish API * * This contains the definition of a Redfish service. * * API version: 2018.3 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package openapi type Operation struct { AssociatedTask IdRef `json:"AssociatedTask,omitempty"` // The name of the operation. OperationName str...
0b0f350111603f5af7bd99674ea6ea735f3ae911
b41c964bf84ddaaffcc627f2d398047db07e074d
umputun/docker-logger
/vendor/github.com/fsouza/go-dockerclient/network.go
Go
go
11,382
permissive
// Copyright 2015 go-dockerclient 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 docker import ( "context" "encoding/json" "errors" "fmt" "net/http" "net/url" ) // ErrNetworkAlreadyExists is the error returned by Cre...
e0133dd3f44c637fc9a710997daf4e30a2ac38ba
bc880580c217090cb79e3e0815d60411982bf9c3
alefcarlos/go-na-pratica
/funcoes/main.go
Go
go
2,324
permissive
/*Um programa é executado sempre pelo pacote main para executar o programa: go run <nomedoarquivo.go> go run main.go */ package main import ( //Ao utilizarmos a função Print do pacote fmt ele é automaticamente importado "fmt" //Ao utilizarmos a função Now() do pacote time, ele é automaticamente importado "time"...
b1220ab33ad0953c7c6d106880878b59fd86f3b4
017a3abc1bc685da8a130c6882dfedbf1c0d6cca
zanjs/light
/light/execer.go
Go
go
390
permissive
package light import ( "database/sql" ) type Execer interface { Exec(query string, args ...interface{}) (sql.Result, error) Prepare(query string) (*sql.Stmt, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row } func GetExecer(db *sql.DB, txs [...
803dccb5f72c7d6431bc1e1285b663692e75e652
199afa1c859bdb1f873c20c62be533877d9d8ffc
dinhxuanvu/ocs-operator
/vendor/github.com/rook/rook/pkg/apis/rook.io/v1alpha2/storage.go
Go
go
4,476
permissive
/* Copyright 2018 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 ...
13f3ff72a3da17b6f10463a9197647557c10e41c
c1608d60cd859123f56ee773a8969111e0cd9a95
5l1v3r1/country-roads
/server/controllers/user_controller.go
Go
go
477
no_license
package controllers import ( "github.com/aliparlakci/country-roads/common" "github.com/aliparlakci/country-roads/repositories" "github.com/gin-gonic/gin" "net/http" ) func UpdateUser(users repositories.UserRepository) gin.HandlerFunc { return func(c *gin.Context) { //TODO: Implement c.JSON(http.StatusOK, gin...
ed4b937e38386d329892e60c8250df15e3dbed6d
c71db4acaa3f928944e1618a3e6cec38ccd9e975
raidiam-services-ltd/terraform-provider-pingaccess
/pingaccess/resource_pingaccess_pingfederate_oauth.go
Go
go
4,842
permissive
package pingaccess import ( "fmt" pa "github.com/iwarapter/pingaccess-sdk-go/pingaccess" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourcePingAccessPingFederateOAuth() *schema.Resource { return &schema.Resource{ Create: resourcePingAccessPingFederateOAuthCreate, Read: resourcePingA...
6a973224af36a8330eebe7433838b7ae7730ffbd
7178e756490f068f09125123af260e9e62fa963b
dazi005/orbit
/backend/orbit-attachment/src/attachment/errorhandler/error.go
Go
go
670
no_license
package errorhandler import "log" func Throws(err error, message string) { if err != nil { log.Printf("error message => [%s] \n", err.Error()) log.Panicln(message + "\n") } } func Throwsf(err error, message string, v... interface{}) { if err != nil { log.Printf("error message => [%s] \n", err.Error()) log...
506b769439917bec0804c7f5b88cac812e1971df
f11eb2c308e5bc352085e80283c9f5e11b60ccc6
smallnest/soar
/ast/node_array.go
Go
go
2,997
permissive
/* * Copyright 2018 Xiaomi, 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...
92b158f08636d611ec470f52033a31649a6ec174
d3c6ee3ef153416a022f32613f01593b5bd86ce5
bobotu/unistore
/tikv/raftstore/worker.go
Go
go
22,029
no_license
package raftstore import ( "bytes" "encoding/binary" "encoding/hex" "fmt" "sync" "sync/atomic" "time" "github.com/ngaut/unistore/tikv/mvcc" "github.com/coocood/badger" "github.com/coocood/badger/y" "github.com/ngaut/log" "github.com/ngaut/unistore/lockstore" "github.com/ngaut/unistore/tikv/dbreader" "g...
28aadd136715f943945c0a2f12239e48b2372e07
f8bdf8d8bbdc7fe7575c23b92bfa3b399a46d30d
everesio/kms-vault-operator
/pkg/controller/kmsvaultsecret/kmsvaultsecret_kvv1.go
Go
go
712
permissive
package kmsvaultsecret import ( vaultapi "github.com/hashicorp/vault/api" k8sv1alpha1 "github.com/patoarvizu/kms-vault-operator/pkg/apis/k8s/v1alpha1" ) type KVv1Writer struct{} func (KVv1 KVv1Writer) write(secret *k8sv1alpha1.KMSVaultSecret, vaultClient *vaultapi.Client) error { decryptedSecretData, err := decry...
6f2f4fc5f7d197a483443d5623e9999c1ca99e9f
59cd6efde01660028c193688d52722fe3963703e
TakiJoe/consul-registy-service
/main.go
Go
go
1,101
no_license
package main import ( conf "exec/config" consul "exec/cons" logs "exec/logs" "github.com/sirupsen/logrus" "net/http" "time" ) func main() { logs.InitLog(conf.GetConf().SiteLogs.LogFilePath) Check: if !consul.GetSvcCode() { logrus.WithFields(logrus.Fields{}).Info("检测到服务端口未启动,等待启动...") time.Sleep(time.Durat...
c282c991422883fb52122df4f45d2dc843e56f44
b8e55155eca0e0eea74202f0d2ee6f628788f658
isabella232/travel
/business/data/auth/auth.go
Go
go
4,168
permissive
// Package auth provides authentication and authorization support. package auth import ( "crypto/rsa" "github.com/dgrijalva/jwt-go" "github.com/pkg/errors" ) // These constants represet the set of roles. const ( RoleAdmin = "ADMIN" RoleEmail = "EMAIL" RoleMutate = "MUTATE" RoleQuery = "QUERY" ) // ctxKey ...
ff5396a681fd979075dd758902d9d70ece915b3c
9ee6d03c04032976b690c427f374e04dff460de6
kidinamoto01/cosmos-sdk
/x/slashing/tick_test.go
Go
go
2,417
permissive
package slashing import ( "testing" "time" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking" ) func TestBeginBlocker(t *testing.T) { ctx, ck, sk, _, keeper := createTestInput(t, DefaultPa...
40a205855b457e2a88a60dd992fd095a84cd176c
453f65f518ec1cdad759051f5f5fcf3b9fe65073
git-garo7/APIBook
/src/router/rotas/rotas.go
Go
go
249
no_license
package rotas import "net/http" //Rota= todas as rotas da api/ //Rota= all api rutes. type Rota struct { URI string Metodo string Funcao func(http.ResponseWriter, *http.Request) RequerAutenticacao bool }
e0757d49cd1f73c9a73546cbec1a0dddc4e9d8ad
787fbf2b9e7a3017a8134800ae790a46bc622055
rajeevtech/ratelimit
/test/service/ratelimit_test.go
Go
go
9,927
permissive
package ratelimit_test import ( "github.com/envoyproxy/ratelimit/src/stats" "sync" "testing" pb "github.com/envoyproxy/go-control-plane/envoy/service/ratelimit/v3" "github.com/envoyproxy/ratelimit/src/config" "github.com/envoyproxy/ratelimit/src/redis" ratelimit "github.com/envoyproxy/ratelimit/src/service" "...
1c15269978fd6955afdf537b310688909de7c185
b56eff5c59b49c8793ee1e06bb2b3675f533bcd5
yudaprama/iso20022
/model/CorporateActionAmounts21.go
Go
go
12,565
permissive
package model // Specifies amounts in the framework of a corporate action event. type CorporateActionAmounts21 struct { // Amount of money before any deductions and allowances have been made. GrossCashAmount *ActiveCurrencyAndAmount `xml:"GrssCshAmt,omitempty"` // Amount of money after deductions and allowances h...
6aedf198858ac4f5c6ed33f8a7f935c71b3504d0
1b9d386539e8d2204851fd352d8ba53d964635ab
sayanh/compass
/components/director/internal/model/runtime_test.go
Go
go
1,166
permissive
package model_test import ( "fmt" "testing" "time" "github.com/kyma-incubator/compass/components/director/internal/model" "github.com/stretchr/testify/assert" ) func TestRuntimeInput_ToRuntime(t *testing.T) { // given desc := "Sample" id := "foo" tenant := "sample" timestamp := time.Now() testCases := []s...
c4a656cf49c074678a30f94f683620e2fa548595
0c91da9e16012c7b06c23ef3760694457585406e
anymaniax/cds
/engine/api/workflowtemplate/loader_test.go
Go
go
2,364
permissive
package workflowtemplate_test import ( "context" "fmt" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/ovh/cds/engine/api/bootstrap" "github.com/ovh/cds/engine/api/test" "github.com/ovh/cds/engine/api/test/assets" "github.com/ovh/cds/engine/api/workflowtempl...
285fdc2981b4a67d7aa86cc0ddcecc5b69859ef0
f44161cb839a7a740095c051d3b391769f15b991
SalmanSaputra17/golang-basic
/src/Basic_2/channel/part1.go
Go
go
429
no_license
package main import( "fmt" "time" ) func pinger(c chan<- string) { for i := 0; ; i++ { c <- "ping" } } func ponger(c chan<- string) { for i := 0; ; i++ { c <- "pong" } } func printer(c <-chan string) { for { msg := <- c fmt.Println(msg) time.Sleep(time.Second * 1) } } func main() { var c chan st...
fc0ab53564e279ae1ad72aad48d670fd6b5b0cd1
c8969c41811cf2a63e49d3691eeee2ba3cb5d62a
Lutimi/CovidPredictor
/prediction_model/prediction_optimize.go
Go
go
5,928
no_license
package predictor import ( "encoding/csv" "fmt" "io" "net/http" "strconv" "os" "log" "github.com/sajari/regression" ) // Predicted = -47873599.4334 + Date*2.3699 // Definir arrays por cada region var listRegion = []string{} // Contiene todas las regiones var dataPerRegion = [][]string{} //Contiene los datos...
39a4e378b87d49f1b82c2e4f27cc16b56957c50d
361ecacfcc1bfa328274b2e2f4f6396e3631b3c4
containerd/containerd
/cmd/containerd/command/oci-hook.go
Go
go
3,719
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...
57953f3227383581e68c3935aa82bb7219d0a908
827f284fe3370e7e72ed749e29efb05c266c6702
trpedersen/dbase
/allocation_bitmap.go
Go
go
5,265
no_license
package dbase import ( "fmt" "sync" ) // Uses techniques from go-bitmap: https://github.com/boljen/go-bitmap const ( bitMapLen = 8 * 1000 // ties in with AllocationPage.allocationMap size ) var ( orMasks = [8]byte{1, 2, 4, 8, 16, 32, 64, 128} // {00000001, 00000010, 00000100, 00001000, 00010000, 00100000, 0100...
d61ff020fb58675465a723aeaa3d679640b9cebf
bfb2ba9071ef5dc049bd17dc0f39171be46bebd1
swtnk/learning-languages
/GoLang/map.go
Go
go
302
no_license
package main import ( "fmt" ) func main() { a := make(map[string]string) a["first_name"] = "swetank" a["second_name"] = "subham" x, y := a["first_name"] fmt.Println(a) fmt.Println(x) fmt.Println(y) b := map[string]string{"first_name": "jonty", "second_name": "rhodes"} fmt.Println(b) }
c554203547f6d857a0a7347a087f5876915f5e3c
88eea20c443e1080cdca794de3705b586b4be8c3
NothingYF/muxer-fmp4
/format/MP4/commonBoxes/stsd.go
Go
go
2,482
no_license
package commonBoxes import ( "bytes" "github.com/NothingYF/muxer-fmp4/codec/AAC" "github.com/NothingYF/muxer-fmp4/codec/H264" ) const ( MP4ESDescrTag = 0x03 MP4DecConfigDescrTag = 0x04 MP4DecSpecificDescrTag = 0x05 ) func stsdH264(avc *H264.AVCDecoderConfigurationRecord, width, height int) (box *MP4...
16eb81982c3dc8523da4690e62d3be1665b5239a
93252d3c1022d8620444e9709c79137d4250af31
avbru/image-previewer
/internal/cache/lru/lru_test.go
Go
go
1,591
permissive
package lru import ( "math/rand" "strconv" "sync" "testing" "github.com/stretchr/testify/require" ) func TestCache(t *testing.T) { t.Run("empty cache", func(t *testing.T) { c := New(10) _, ok := c.Get("aaa") require.False(t, ok) }) t.Run("simple", func(t *testing.T) { c := New(5) _, inCache := c....
e72a052b83b3b10bb0f8a361ddabf94e306d9bab
e9a6cd80f63911f8b0fcf3b6454588c317c70a05
microsoftgraph/msgraph-sdk-go
/models/education_assignment_points_grade.go
Go
go
3,088
permissive
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // EducationAssignmentPointsGrade type EducationAssignmentPointsGrade struct { EducationAssignmentGrade } // NewEducationAssignmentPointsGrade instantiates a ...
3100a9cca1073cd8869ac02c98b02c3f379937b7
98b83998999d5d0c5dd9a4f285d39e69b4df5c49
GPrabhudas/LeetCode_archived
/Tree/maximum-binary-tree/solution_01.go
Go
go
1,051
no_license
// // time complexity o(n*n) package main // import ( // "fmt" // ) // func main() { // root := constructMaximumBinaryTree([]int{3, 2, 1, 6, 0, 5}) // inorder(root) // fmt.Println() // } // // TreeNode ... // // tree type exported from tree package // type TreeNode struct { // Val int // Left *TreeNode // ...
70566b568d315aff59a2b1498c1cb3430256347c
7e2ae56ff79a486c157cff6d393f0270258326fa
Thiiamas/GoStar
/.history/src/main_20201116213803.go
Go
go
3,924
no_license
package main import ( "fmt" "Thiiamas/Utils" "math/rand" "time" ) func main() { size := 5 board := createBoard(size,"00") goal := findGoal(size) board.Draw() fmt.Println("//////////////////") sons := findSonStates(board) utils.Draw(sons) if false { fmt.Println("Board :") board.Draw() fmt.Println("G...
db73aa19415a2ace7158394a5e5189c2247af0ce
f88204881817f91e303c7ced0331293a8d05feed
keethii27/go_study_twitter_app
/serach/serach.go
Go
go
1,423
no_license
package serach import ( "github.com/labstack/echo" "go_sample/twitter" "net/http" ) func Tweet(c echo.Context) error { value := c.QueryParam("value") api := twitter.ConnectTwitterApi() //検索 searchResult, _ := api.GetSearch(`"`+value+`"`, nil) tweet := new(TweetTempete) for _, data := range searchResult.Statu...
d7a8c80f8ed77273ca0d020af0abc9dc6e17f9c3
c21ec1d88f314a96f6d16e3765ad7c3d57f3651a
LonelyPale/gopkg
/net/http/middleware/hertz/handler.go
Go
go
3,885
permissive
package hertz import ( "context" "errors" "fmt" "reflect" "github.com/cloudwego/hertz/pkg/app" "github.com/cloudwego/hertz/pkg/protocol/consts" log "github.com/sirupsen/logrus" "github.com/lonelypale/gopkg/errors/status" "github.com/lonelypale/gopkg/net/http" "github.com/lonelypale/gopkg/ref" ) // Bind 转换...
490dff844a3bd200913d2f2fe594d88c4ea802e2
ff61146f7a39b861643f13a8510e85634de22387
wjimenez5271/migration-tools
/vendor/github.com/openshift/origin/vendor/k8s.io/kubernetes/federation/pkg/federation-controller/util/handlers.go
Go
go
2,521
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, ...
4b07e416eeb69037679f85bedb8852d4bad3dc20
c8d909b24cbeb0b2a075b024facdf714676a0de2
adamgoose/terraform-provider-spinnaker
/provider/pipeline_trigger_resource.go
Go
go
4,062
permissive
package provider import ( "errors" "log" "strings" "github.com/google/uuid" "github.com/hashicorp/terraform/helper/schema" "github.com/mitchellh/mapstructure" ) var errInvalidTriggerImportKey = errors.New("Invalid import key, must be pipelineID_triggerID") func triggerResource(in map[string]*schema.Schema) ma...
a8110cb745e8a859f78c9cf631bd33af983421d2
5549131562c8df8c1d6778857931dbfa6af08186
caiwk/drag
/pkg/mod/github.com/lni/dragonboat@v2.1.7+incompatible/monkeynoop.go
Go
go
872
permissive
// Copyright 2017-2019 Lei Ni (nilei81@gmail.com) // // 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 ...
871fad71f291d547825b2abebf279ecdeb1bd9d8
b4d5d6388b2562ce30a3e948ba1b8a5193387887
sgtest/monorepo-test-3
/kubernetes-7/pkg/client/listers/authorization/v1beta1/localsubjectaccessreview.go
Go
go
4,086
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, ...
be17ca3221928010fa9e50d17972e2794fd4f0f5
26b34a6481b14820f71b116a6c94cf58655cf4bc
bear-metal/eve
/pkg/pillar/types/zedmanagertypes.go
Go
go
10,888
permissive
// Copyright (c) 2017 Zededa, Inc. // SPDX-License-Identifier: Apache-2.0 package types import ( "fmt" "net" "time" "github.com/google/go-cmp/cmp" "github.com/lf-edge/eve/pkg/pillar/base" uuid "github.com/satori/go.uuid" ) type UrlCloudCfg struct { ConfigUrl string MetricsUrl string StatusUrl string Log...
b80b963029660d99f5add5aaac9acddb154bd00a
112ae8e8f009073fd86294d2d15cf619e98ffa19
zypeh/goloquent
/test/model.go
Go
go
2,101
permissive
package test import ( "encoding/json" "fmt" "time" "cloud.google.com/go/datastore" "github.com/bxcodec/faker" "github.com/zypeh/goloquent" ) var ( my *goloquent.DB nameKey = datastore.NameKey("Name", "hIL0O7zfZP", nil) symbolKey = datastore.NameKey("Name", "VEknB=YnisrgS0w'9Hg,TWpSQtg7w/b0recIBLkjp...
8c17c27628c884b576559cc3e9c4b434e8997983
dd8eff7f36960cb7946a5946c27658371f392f58
AdamColton/luce
/util/luceio/writertos.go
Go
go
428
no_license
package luceio import "io" // WriterTos takes a slice of WriterTos and provides a single WriteTo method // that will call each of them. type WriterTos []io.WriterTo // WriteTo invokes each of the WriterTos. func (wts WriterTos) WriteTo(w io.Writer) (int64, error) { var sum int64 for _, wt := range wts { n, err :...
c61f94098561c35c550c35c7c5f61d83d4647ae4
5d14b77d59167e726d8880dc80b7213dd1265aac
Tknott95/Ace_Go
/Controllers/SgridCtrl/sg_ctrl.go
Go
go
1,662
no_license
package sGrid_Ctrl import ( "encoding/json" "fmt" "log" "net/http" "github.com/julienschmidt/httprouter" sendgrid "github.com/sendgrid/sendgrid-go" "github.com/sendgrid/sendgrid-go/helpers/mail" globals "github.com/tknott95/Ace_Go/Globals" ) type Email struct { SenderEmail string `json:"mail-email"` Email...
156fa1821de03087c0fd9d2321b13a2eb942deb1
03cac7663c0450c93f1a782d3d30d3178ae737d0
adevinta/security-overview
/report/overview_generator.go
Go
go
5,301
permissive
package report import ( "fmt" "net/url" "strconv" "time" "github.com/aws/aws-sdk-go/aws" "github.com/danfaizer/go-chart" "github.com/adevinta/security-overview/config" "github.com/adevinta/security-overview/vulcan" ) // GenerateOverview generates content of the overview report suitable to be send as email. ...
157f36cf491e091cc22c143b7ba7d06519ec52f2
6c6d107890b3e9ad7c93514dd3fe2948107f1b63
Azure/azure-storage-azcopy
/cmd/zc_traverser_blob_versions.go
Go
go
4,636
permissive
// Copyright © Microsoft <wastore@microsoft.com> // // 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, me...
bc2e868c7442c16ec3b739b41c69c79f74cc4987
79ac0e399abe4931d66fe918ee966da3149de736
trannguyenhung011086/learn-go-web
/cmd/web/handlers.go
Go
go
2,271
no_license
package main import ( "fmt" "html/template" "net/http" "path/filepath" "strconv" "trannguyenhung011086/learn-go-web/pkg/models" ) func (app *application) home(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { app.notFoundError(w) return } s, err := app.snippets.Latest(10) if err != nil {...
3c7a22a62d339cbd952a79935c09938750da9b2e
0ace56cf5514338aa70a942d1c87ae8b913d0133
Somatic-KZ/sso
/internal/domain/manager/auth/password.go
Go
go
445
no_license
package auth import ( "golang.org/x/crypto/bcrypt" ) const cost = 10 // сложность хэша, чем больше это число, тем дольше его подсчет func HashPassword(password string) ([]byte, error) { return bcrypt.GenerateFromPassword([]byte(password), cost) } func CheckPasswordHash(password string, hash []byte) bool { err :=...
23f99c33dd1b75572f37eab5c29ff43497d432d1
7a4856bd84b0f82c0a5cb23a9dadd9a9719e9b2e
Schnitzel/openstorage
/pkg/storageops/azure/azure.go
Go
go
20,219
permissive
package azure import ( "context" "fmt" "os" "path/filepath" "strconv" "strings" "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/adal" "github.com/Azure/go-autorest/autorest/azure" "github.com...
9017bab044ecc86fb5d6a4c94ea869a533800e4d
7c4a811a838b7cc41d7c41a58c2992240ad66bcf
geekrichie/fun
/model/user.go
Go
go
353
no_license
package model import ( "gorm.io/gorm" ) type User struct { gorm.Model Name string Password string } func (u User) TableName() string { return "user" } func NewUser(name, password string) *User { return &User{ Name: name, Password: password, } } func (u *User) Create() error { result := GetDb()....
17d6622945741b90c5361b15fab27b73b9890c29
a643216b88434cdae53ee12c144b05fd97519fa3
my6889/k8s.yaml
/heapster/vendor/k8s.io/client-go/listers/core/v1/secret.go
Go
go
3,094
permissive
/* Copyright 2018 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 ...
833a3f849672a18b9cacd1ebdb9d37f7f8fc11a2
f3e2186fbf8b77470fa00a2b3e15eaa507fc2446
alekseysychev/WB-tech
/stage-1/07.go
Go
go
338
no_license
package main // Реализовать конкурентную запись в map. import ( "fmt" "sync" ) func main() { m := make(map[int]int) var wg sync.WaitGroup var mx sync.Mutex for i := 0; i < 10; i++ { wg.Add(1) go func() { mx.Lock() m[1] = 1 mx.Unlock() wg.Done() }() } wg.Wait() fmt.Println(m) }
9a120276a7f01bf5c4427f8af938de3df8295491
2e0816f26fe1f0d029d3f29148289b5e248a3656
Jeeva-Sudhegan/GoLangTutorial
/src/structures/packages/structs.go
Go
go
549
no_license
package packages /* user defined type collection of fields group data into single unit */ // declaring structure // syntax // type <struct_name> struct { // <var_name> <var_type> // .... // } // to export structs, capitalize starting words // also the fields so that they can be accessed from packages type Student...
9d78d9f2323b59445c84f6d62c3554ca4f540037
e7abc9f6ce222ff6624847d0e20a306d9460c60c
Cargill/go-arty
/artifactory/groups.go
Go
go
3,419
permissive
// Copyright (c) 2016 John E. Vincent // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
fec54b20861ae04051cd7c261ce862cbe85d4d64
fa60efc97c3add1836a54eed430be4f6a6079b41
joaoinaciozup/charlescd
/compass/web/api/v1/metric.go
Go
go
2,938
permissive
package v1 import ( "compass/internal/metric" "compass/internal/metricsgroup" "compass/web/api" "net/http" "github.com/google/uuid" "github.com/julienschmidt/httprouter" ) type MetricApi struct { metricMain metric.UseCases metricGroupMain metricsgroup.UseCases } func (v1 V1) NewMetricApi(metricMain met...
6d967c574fc4bda3229d26a89959ae8d4bff367d
a050461db502f94590a3108707152561c6fe7ea9
srijan-deepsource/driftctl
/pkg/resource/aws/aws_s3_bucket_test.go
Go
go
911
permissive
package aws_test import ( "testing" "github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test/acceptance" ) func TestAcc_AwsS3Bucket_BucketInUsEast1(t *testing.T) { acceptance.Run(t, acceptance.AccTestCase{ TerraformVersion: "0.14.9", Paths: []string{"./testdata/acc/aws_s3_bucket"...
00f736885b4896ed99764565d619487d99ec89a7
23d761fefbc772bc218bcb599f624bfc36d68f12
wenzi1/gf
/encoding/gjson/gjson_api_new_load.go
Go
go
10,503
permissive
// Copyright GoFrame Author(https://goframe.org). 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://github.com/gogf/gf. package gjson import ( "bytes" "reflect" "github.com/gogf/...
6b359145aa76d6132066df4ad33acc47093aebd0
0cfe86e00d775bb2187c7d10d444889fe9168c13
storswift/lotus
/chain/deals/provider_states.go
Go
go
6,876
permissive
package deals import ( "bytes" "context" ipldfree "github.com/ipld/go-ipld-prime/impl/free" "github.com/ipld/go-ipld-prime/traversal/selector" "github.com/ipld/go-ipld-prime/traversal/selector/builder" unixfile "github.com/ipfs/go-unixfs/file" "golang.org/x/xerrors" "github.com/filecoin-project/lotus/api" ...
ce8a0761c1362ad2f1d067e69789f613e98eb6b8
4f2c58dc2da5537b3708042bb6616d1d367b16bd
BJ-Lin/lotus
/cli/client.go
Go
go
64,307
permissive
package cli import ( "bufio" "context" "encoding/json" "errors" "fmt" "io" "math" "math/rand" "os" "path/filepath" "sort" "strconv" "strings" "sync" "sync/atomic" "text/tabwriter" "time" tm "github.com/buger/goterm" "github.com/chzyer/readline" "github.com/docker/go-units" "github.com/fatih/color...
42a3c61975598fb399749d38c2a32fd76a87f582
842ae09bb3b70472844fd266c3aebc9ce21c0540
ilovejs/go-koans
/about_control_flow.go
Go
go
1,228
no_license
package go_koans import "fmt" func aboutControlFlow() { //WTF is block ?? { a, b, c := 1, 2, 3 assert(a == 1) // multiple assignment assert(b == 2) // can make assert(c == 3) // life easier } var str string { if 3.14 == 3 { str = "what is love?" } else { str = "baby dont hurt me" } assert...
33b526a66de2b9949b68ce04e7e81109514687ed
96cabd6b9fe7d17dd8a4112515550163854f7350
jckuester/awsls
/aws/aws_transfer_server.go
Go
go
807
permissive
// Code is generated. DO NOT EDIT. package aws import ( "context" "github.com/aws/aws-sdk-go-v2/service/transfer" "github.com/jckuester/awstools-lib/aws" "github.com/jckuester/awstools-lib/terraform" ) func ListTransferServer(ctx context.Context, client *aws.Client) ([]terraform.Resource, error) { var result [...
653b35216db6e03c77ce490a79bb3ee0daeecc76
8ddcc33c85ed59f14f0d3fe3e2baac30865aa662
bluebossa63/istio
/pilot/pkg/serviceregistry/serviceentry/conversion.go
Go
go
11,806
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...
47a2d5091a639f186917ec4b65e59fadde0270fd
ba31c6ea0f5ec7523abb06a338052f99b75cbeab
BanMing/LuaVm
/go/state/api_compare.go
Go
go
1,799
no_license
package state import "luavm/go/api" // [-0, +0, e] // http://www.lua.org/manual/5.3/manual.html#lua_compare func (self *luaState) Compare(idx1, idx2 int, op api.CompareOp) bool { if !self.stack.isValid(idx1) || !self.stack.isValid(idx2) { return false } a := self.stack.get(idx1) b := self.stack.get(idx2) swit...
ca92d4af8df8fca32a345ceec39206fa9bcade23
179104ce73c3e6aeae25667a6fe0f77d4984a447
yukatakahara/doc-api
/cmd/cli/delete-clinic.go
Go
go
982
no_license
package main import ( "flag" "log" "os" "github.com/oren/doc-api/bolt" "github.com/oren/doc-api/config" ) func DeleteClinic(cmd *flag.FlagSet) { configPath := cmd.String("config", "", "Config file (Optional)") adminJWT := cmd.String("jwt", "", "Admin's JWT. (Required)") id := cmd.String("id", "", "Clinic's I...
f6be75b785d1ee96db1b8bcc665b1b68edfe18d8
1add3955441a2ea1547f610b37ef9f147cafdc8b
WeberLong/go-zmxy
/zmop/requests/ZhimaAuthInfoAuthorizeRequest.go
Go
go
2,989
no_license
package requests import ( "fmt" "github.com/WeberLong/go-zmxy/zmop/interfaces" ) type ZhimaAuthInfoAuthorizeRequest struct { bizParams string // 业务扩展字段,页面授权接口需要传入auth_code,channelType,stateauth_code授权码,值取决于授权方式和身份类型PC方式,身份类型identity_type=1:{"auth_code":"M_MOBILE_APPPC"}PC方式,身份类型identity_type=2:{"auth_code":"M...
7f5007f0529dd8cd347f45db6dd68655091ed553
fc2cb8e52ebc2cb5ac4be85fd3fd7f048f26bbae
john-deng/service-mesh-hub
/services/mesh-networking/pkg/routing/traffic-policy-translator/preprocess/validator.go
Go
go
8,486
permissive
package preprocess import ( "context" "net/http" "github.com/gogo/protobuf/types" "github.com/hashicorp/go-multierror" "github.com/rotisserie/eris" "github.com/solo-io/go-utils/stringutils" zephyr_core_types "github.com/solo-io/service-mesh-hub/pkg/api/core.zephyr.solo.io/v1alpha1/types" zephyr_discovery "git...
76aa70c6fa64a659e6371dc0ef614f1b0caebcb5
279a343f85b415c7f7643a4b5112511d0780c43c
cloudboss/unobin
/vendor/github.com/awslabs/goformation/v5/cloudformation/emr/aws-emr-instancegroupconfig_configuration.go
Go
go
2,291
permissive
package emr import ( "github.com/awslabs/goformation/v5/cloudformation/policies" ) // InstanceGroupConfig_Configuration AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.Configuration) // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html type In...
a3fe527da66af17c0d65d77fa6557b33930edd2d
63a6da61cd6f81adec2d57d3ae45cb4f1d05ec10
tmthrgd/ip-blocker-agent
/blocker_linux.go
Go
go
401
permissive
// Copyright 2016 Tom Thorogood. All rights reserved. // Use of this source code is governed by a // Modified BSD License license that can be found in // the LICENSE file. // +build linux //go:generate sh -c "GOARCH=386 go tool cgo -godefs blocker.go | gofmt > blocker_linux_386.go" //go:generate sh -c "GOARCH=amd64 g...
f370faab99e01425a0879911388cdff608f95a91
13863358589737f4d8d2e26f27746a0f85df3f08
krzyzacy/contrib
/mungegithub/mungers/approval-handler.go
Go
go
11,924
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, ...
3e8db3d581216f29827fcafa658427c941c13980
a51eaf25bde8d8f62a4d7da3e009e971423eb344
SavoBit/go-elasticsearch
/internal/cmd/generate/commands/genexamples/generator.go
Go
go
2,484
permissive
// Licensed to Elasticsearch B.V. under one or more agreements. // Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. package genexamples import ( "bytes" "fmt" "io" "strings" ) // SrcGenerator represents the generator for ...
d7c9c4d7ddf5dc11684f21a4bdc1271e0b0ef710
f34abd799900c17cee8795ec8cc15f388f8bb16c
sham-ui/sham-ui-cli
/templates/content-site/template/site/server/site/site.go
Go
go
647
permissive
package main import ( "github.com/gorilla/context" "github.com/urfave/negroni" "net/http" "site/app" "site/config" "site/logger" "site/ssr" "strconv" ) func main() { logr := logger.NewLogger(0) config.LoadConfiguration(logr, "config.cfg") n := negroni.New(negroni.NewRecovery(), logger.CreateNegroniLogger(l...
3e014949be8bcd5c953f5fe9f2eaaed6b611c180
1f4fc31ca78f1527748c0601bb3fe3ce01ac8703
dcarbone/go-salesforce-sdk
/codegen/from_describe_test.go
Go
go
3,446
permissive
package codegen_test import ( "testing" "text/template" "github.com/beeekind/go-salesforce-sdk/codegen" "github.com/beeekind/go-salesforce-sdk/metadata" "github.com/stretchr/testify/require" ) var fromDescriptionTests = map[*metadata.Describe][]codegen.Struct{ { Name: "foo", Fields: []*metadata.Field{ {...
6cf819ae02e24eed989bcaff9ad706e07be464be
22d21ac12b0a45192e77b85143d1428c7e9fd7d7
zeyaddeeb/polyaxon
/operator/controllers/service.go
Go
go
7,450
permissive
/* Copyright 2018-2020 Polyaxon, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
ab4c56c2de099d274cbef2e29a82b13a1788bbd0
c083d9f809e9b934b9cc8bafbf568f60261f9a69
hudson741/pytorch-operator
/pkg/controller.v1/pytorch/status.go
Go
go
10,048
permissive
// Copyright 2018 The Kubeflow 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 agr...
c8a6667850b6d949a23f71263f12f1c5ac46cec6
32b388cf0b71ec2961722f54cc9d5019c8a99572
sandboxgames/rpcx-ui
/service/config.go
Go
go
1,266
no_license
package service import ( "encoding/json" "fmt" "io/ioutil" "os" "strings" ) func init() { LoadConfig() } // Config parameters var ServerConfig = Configuration{} var Reg Registry func LoadConfig() { file, e := ioutil.ReadFile("./config.json") if e != nil { fmt.Printf("File error: %v\n", e) os.Exit(1) } ...
6728a344767db19cec77aee8b6cb5f8d3586fbf7
19c44c9f659306a110d93eda047337863a67b558
JeffreyBool/gozinx
/game/api/world_chat.go
Go
go
1,039
permissive
/** * Author: JeffreyBool * Date: 2019/5/17 * Time: 03:15 * Software: GoLand */ package api import ( "github.com/JeffreyBool/gozinx/src/znet/router" "github.com/JeffreyBool/gozinx/src/ziface" pd "github.com/JeffreyBool/gozinx/game/proto" "github.com/gogo/protobuf/proto" "fmt" "github.com/JeffreyBool/goz...
01c9151a48d31256a03976d94573bbd95c1bca51
251855c8ddd0be8a5b29ec72c1b794cdd4c58935
romainDavaze/hamilton
/msgraph/directory_role_templates_test.go
Go
go
4,924
permissive
package msgraph_test import ( "testing" "github.com/manicminer/hamilton/auth" "github.com/manicminer/hamilton/internal/test" "github.com/manicminer/hamilton/msgraph" ) type DirectoryRoleTemplatesClientTest struct { connection *test.Connection client *msgraph.DirectoryRoleTemplatesClient randomString s...
b55a29e52e670e3bb527c72bbf9cd486ee4db564
ce0bcec3e319901822aca2d6abfac6c274aa5052
CodeCmn/xupercore
/kernel/permission/acl/contract.go
Go
go
5,866
permissive
package acl import ( "encoding/json" "fmt" "github.com/xuperchain/xupercore/kernel/contract" "github.com/xuperchain/xupercore/kernel/contract/sandbox" "github.com/xuperchain/xupercore/kernel/permission/acl/utils" pb "github.com/xuperchain/xupercore/protos" ) type KernMethod struct { BcName s...
ee1b053a911472be48933ee6bfe3244e21693c56
7eef7b9292df679b32291c4a7d11badb9ecd5e82
fraidev/advent-of-code-go
/01/part01/main.go
Go
go
783
permissive
package main import ( "bufio" "fmt" "log" "os" "strconv" ) func main() { inputs := getInputs() result := find2020(inputs) fmt.Println(result) } func find2020(inputs []int64) int64 { for _, i := range inputs { for _, h := range inputs { if (i + h) == 2020 { return i * h } } } panic("not fo...
f0e660cc575960a84f8ded34e0e601f31768b6ee
0cee5ac4d8b2af63d6e97db5f696f7da0534d5d8
hw-standalonecomplex/netstack
/tcpip/link/waitable/waitable.go
Go
go
4,453
permissive
// Copyright 2018 Google 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 ...
899a586d59f757613fc8ca0d7715d7816b4bf366
08bb1df0bb5c23703675d326bd479e2a0d0296fc
igortin/go-in-action
/chapter3/goroutines-counter-words/main.go
Go
go
1,252
no_license
package main import ( "bufio" "fmt" "os" "strings" "sync" ) func main() { var wg sync.WaitGroup w := newWords() for _, f := range os.Args[1:] { // Wait Group counter increase wg.Add(1) go func(file string) { if err := tallyWords(file, w); err != nil { fmt.Println(err.Error()) } // Wait Gro...
9f941867f90d9a6e3af09fc2e2254ea6d6e47f84
8f09ee2d5fe7559d65a1075f523c04475017e797
yanghaomai/daos
/src/control/lib/spdk/mocks.go
Go
go
3,333
permissive
// // (C) Copyright 2018-2020 Intel Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable la...
c0455f3740bbf2ab8860662352e45f557f786c2e
f3cdf8a844931473167fcb2aefa5cfb1d43b0c60
hardtosaygoodbye/sues-go
/controller/middleware/logger.go
Go
go
8,040
no_license
package middleware import ( "bytes" "encoding/json" "fmt" "github.com/gin-gonic/gin" "io" "io/ioutil" "net/http" "os" "time" "github.com/mattn/go-isatty" ) type consoleColorModeValue int const ( autoColor consoleColorModeValue = iota disableColor forceColor ) var ( green = string([]byte{27...
9be91f1392c2856866602a715cd68c63d51f7c3b
3d99cf5b8fb7dc86cace6869ea87e2c409fe642e
tjanez/oasis-explorer
/services/charts.go
Go
go
2,650
no_license
package services import ( "oasisTracker/services/render" "oasisTracker/smodels" ) func (s *ServiceFacade) GetChartData(params smodels.ChartParams) ([]smodels.ChartData, error) { data, err := s.dao.GetChartsData(params) if err != nil { return nil, err } return render.ChartData(data), nil } func (s *ServiceF...
f58e30cbd80d71bfee9e314c2de1b1a958dda8c1
bbfeb756fcbf6588bfe6088dc71afcdcd53f2c80
SupaatWisetsud/Product-RestAPI-GO-
/middleware/authorization.go
Go
go
619
no_license
package middleware import ( "net/http" "product/models" "github.com/casbin/casbin" "github.com/gin-gonic/gin" ) func Authorization(ctx *gin.Context) { sub, ok := ctx.Get("sub") if !ok { ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"}) return } user := sub.(*models.User) ...
1ef9a1d35da964f370ba14ea4d8d47e337ff6cc5
15d5e60f37a9ad9378479f1a61e562292b1ce512
KeyongSun/lynx
/plugin/tower/pkg/informer/reflector.go
Go
go
9,515
permissive
/* Copyright 2021 The Lynx 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, softwa...
ee6e14270116fad13a87d8c70b230180825c58b7
62af3e20f8dd470d79d0e582cb16ca52a2c41e37
gerdgrimmen/go-programming-language
/goku/_example/simple_sql_parser.go
Go
go
6,386
no_license
// from: https://blog.gopheracademy.com/advent-2014/parsers-lexers/ package main import ( "bufio" "bytes" "io" "strings" "fmt" ) type Token int const ( // Special Tokens ILLEGAL Token = iota EOF WS // Literals IDENT // fields, table_name // Misc characters ...
070f810a9b83a64b7516c60876f15b7ab57087d3
38af879ffa86ce413ecb317bd355ddffad1da2c7
dictyBase/modware-import
/internal/k8s/manifest/arangodb.go
Go
go
710
permissive
package manifest import ( apiv1 "k8s.io/api/core/v1" ) func ArangoSecManifest() []apiv1.EnvVar { return []apiv1.EnvVar{ { Name: "ARANGODB_PASS", ValueFrom: &apiv1.EnvVarSource{ SecretKeyRef: &apiv1.SecretKeySelector{ LocalObjectReference: apiv1.LocalObjectReference{ Name: "dictycr-secret-dev"...
151bc79ca49d01e2ff5d299b2fc1084fdf163487
32d2788c01bb3db620d7272da54f087789fc4b6a
jackzampolin/ibc-go
/modules/light-clients/06-solomachine/types/update.go
Go
go
2,982
permissive
package types import ( "github.com/cosmos/cosmos-sdk/codec" 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" "github.com/cosmos/ibc-go/modules/core/exported" ) // CheckHeaderAndUpdateState checks if ...
ddcc1fa791969aa9b9ab1bf6a6a8117f60166185
7864d82464d57c6db38dd22665528828db4a78d5
baxiang/luban
/strings/sql.go
Go
go
1,886
no_license
package strings import ( "net/http" "strings" ) // LikeFieldEscape 转义 SQL 的 like 模糊查询时字段值为通配符的值 func LikeFieldEscape(value string) string { value = strings.Replace(value, ";", "\\;", -1) value = strings.Replace(value, "\"", "\\\"", -1) value = strings.Replace(value, "'", "\\'", -1) value = strings.Replace(value...
5dbd7062796e9117f0802053277dca659f648e54
4cb4bc5edadc2c5e9df27d84bf762a6a41c41a42
SilverRainZ/tools
/gopls/internal/lsp/lsprpc/lsprpc_test.go
Go
go
10,275
permissive
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lsprpc import ( "context" "encoding/json" "errors" "regexp" "strings" "testing" "time" "golang.org/x/tools/gopls/internal/lsp/cache" "golang....
e74a1c0e92b10f71fc88d01d8399d154bb79f3a9
de7920171fb501aad23acb323601af2f55fb8960
ticruz38/0x-go-contracts
/contracts/balance/EthBalanceChecker.go
Go
go
9,790
no_license
// Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. package balance import ( "math/big" "strings" ethereum "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ether...
7ed56c0a48dbc72284e0f95644ccfbb626887d10
9bf9ed79a75eed070f8e02ad2b88d4c4d1ed013e
kubedb/cli
/vendor/github.com/elastic/go-elasticsearch/v8/typedapi/types/decayplacementdatemathduration.go
Go
go
2,729
permissive
// Licensed to Elasticsearch B.V. under one or more contributor // license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright // ownership. Elasticsearch B.V. licenses this file to you under // the Apache License, Version 2.0 (the "License"); you may // not use ...
fe1cec2382e773f5adc842f381baa01a82568dc1
260c522bd51622ba15bd5c89e351cf3b15842c30
go-http/dingtalk
/topapi_report_create.go
Go
go
2,431
no_license
package dingtalk import ( "bytes" "encoding/json" "net/http" "net/url" ) const ( REPORT_CREATE_URL = DINGTALK_API_URL + "/topapi/report/create" ) //填报的日志内容 type ReportContentToSend struct { Content string `json:"content"` Key string `json:"key"` Sort int `json:"sort"` Type int ...
5583b7e68bcb5b09425ff8df896736f842106ad4
8338e55bfeac43e6dbba8448b4a777e1937e7763
ravilushqa/antibruteforce-praktika
/cmd/reset.go
Go
go
1,171
permissive
package cmd import ( "context" apipb "github.com/ravilushqa/antibruteforce/internal/antibruteforce/delivery/grpc/api" "github.com/spf13/cobra" "google.golang.org/grpc" "log" "time" ) func init() { reset.PersistentFlags().StringVarP(&address, "address", "a", "localhost:50051", "antibruteforce address") reset.P...
06025c84161167dfe5931a066110b26e1c28c784
741bfcf5ff1662d861d9a8a7aac24a23fb3ef4b6
bettery-io/Cosmos_bettery
/x/privateevents/client/cli/query.go
Go
go
836
no_license
package cli import ( "fmt" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" "github.com/VoroshilovMax/Bettery/x/privateevents/types" ) // GetQueryCmd returns the cli query commands for this module func GetQueryCmd...