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 |
|---|---|---|---|---|---|---|---|---|
0aa69c682adaa739ef9568db2e62ef834b6d9749 | 087dc9dbf632c9390a29dbb00eca5fd17945d513 | stanford-esrg/tls-webserver-configuration-scanner | /zgrab2/lib/http2/h2c/h2c.go | Go | go | 13,975 | permissive | // Copyright 2018 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 h2c implements the unencrypted "h2c" form of HTTP/2.
//
// The h2c protocol is the non-TLS version of HTTP/2 which is not available from
// net/http ... |
02da8b552e0b827d0eff3b56579b3163c5690974 | f81d98fc269f90ffc808a7ebce70acd7d77022a3 | karsibali/solutions | /exercism/go/roman-numerals/cases_test.go | Go | go | 693 | no_license | package romannumerals
// Source: exercism/problem-specifications
// Commit: 070e8d5 roman-numerals: Fix canonical-data.json formatting
// Problem Specifications Version: 1.0.0
type romanNumeralTest struct {
arabic int
roman string
hasError bool
}
var romanNumeralTests = []romanNumeralTest{
{1, "I", false},
... |
eebf3e715276f69e254a21ce8e1f27723c0e73ab | 45fbe91f89be6a1d40d6311ff0fa2cd528178757 | waytai/jdcloud-sdk-go | /services/billing/client/BillingClient.go | Go | go | 3,435 | permissive | // Copyright 2018 JDCLOUD.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 law or agreed to in ... |
490541d5f5453923e659764582f0ce8dc4850c20 | db0186e65f92ecbb61cc56448f1ef0020134a302 | dianqiji/contrail | /pkg/types/logical_router.go | Go | go | 18,637 | permissive | package types
import (
"context"
"strconv"
"github.com/Juniper/asf/pkg/errutil"
"github.com/Juniper/asf/pkg/format"
"github.com/Juniper/asf/pkg/models/basemodels"
"github.com/Juniper/asf/pkg/services/baseservices"
"github.com/Juniper/contrail/pkg/models"
"github.com/Juniper/contrail/pkg/services"
"github.com... |
c33f3837556fc0ea6d9e597b7a9cfcaf3543055b | 00390522a4acced2a7be7140ccec633fc66522b3 | kubedb/cli | /vendor/github.com/elastic/go-elasticsearch/v8/typedapi/types/jobsrecord.go | Go | go | 21,312 | 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 ... |
42f6e5108108b6adc1acf10b6c0e5c375339639f | 36b049143d9c4a0010bd523edc20ef09a6ba9b19 | chadr123/vpp | /plugins/controller/api/healing.go | Go | go | 2,019 | permissive | // Copyright (c) 2018 Cisco and/or its affiliates.
//
// 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... |
7b87c6dbe5a0b4bc6f213c37d0b14a35a235ef8b | bd19d630f8975975c3c95f1c41c637a209054553 | TheJaySmith-Google/pulumi-google-native | /sdk/go/google/dns/v1beta2/getResponsePolicy.go | Go | go | 1,431 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v1beta2
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Fetches the representation of an existing Response Policy.
func LookupResponsePolicy(ct... |
439af30accd419b77c0181c4be992d8c417f8560 | c967b6996ea0d40b852600386a418a50efa70544 | Saafo/lighter-portainer | /api/http/handler/registries/registry_configure.go | Go | go | 4,824 | permissive | package registries
import (
"net/http"
"strconv"
httperror "github.com/portainer/libhttp/error"
"github.com/portainer/libhttp/request"
"github.com/portainer/libhttp/response"
"github.com/portainer/portainer/api"
)
type registryConfigurePayload struct {
Authentication bool
Username string
Password ... |
98669f1e2ca23476390a5d8fa912bbdae554b597 | 137ee2daa9950abaa6e4dddafc20093178109da0 | wonderking/EdgeNode | /internal/nodes/listener_udp.go | Go | go | 4,445 | no_license | package nodes
import (
"errors"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"github.com/TeaOSLab/EdgeNode/internal/stats"
"github.com/TeaOSLab/EdgeNode/internal/utils"
"net"
"sync"
"time"
)
type UDPListener struct {
BaseListener
Listener *net.UDPCon... |
60fbf81861e736a9c13796f90b93d69d338ba53a | 4e5cb726f792e3fab67c38396801cef038b88958 | aiwantaozi/types | /apis/management.cattle.io/v3/zz_generated_project_controller.go | Go | go | 7,208 | permissive | package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/ap... |
9c38c28d7395ca44ebe3110e8071092fa007b958 | bba41b814036845f2a7dd167e0e7706bbcd13d66 | jesuzsh/golang-practice | /1.7/server1.go | Go | go | 364 | no_license | package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", handler) // each request calls handler
log.Fatal(http.ListenAndServe("localhost:8000", nil))
}
// handler echoes the Path component of the request URL r.
func handler(w http.ResponseWriter, r *http.Request) {
//fmt.Fprintf(w, "UR... |
f48a0500c11781184d94bf3d384e15cc795aad68 | 633565d452effcd6757cf43ecf114f3bb207675e | Melon-Tropics/chainlink | /core/store/migrations/0012_change_jobs_to_numeric.go | Go | go | 781 | permissive | package migrations
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
const (
up12 = `
ALTER TABLE job_specs ALTER COLUMN min_payment TYPE numeric(78, 0) USING min_payment::numeric;
ALTER TABLE flux_monitor_specs ALTER COLUMN min_payment TYPE numeric(78, 0) USING min_payment::numeric;
`
down12 = `... |
bf336345b7f0856bbbf122ca984e7b9e5f8f2649 | d268d73f4a2748a1fd8777d891e152d95876d08a | Dredhog/go_engine3d | /generate/mesh/plane.go | Go | go | 2,046 | no_license | package mesh
func GeneratePlane(w, h float32, divX, divZ int) (floats []float32, indices []uint32, err error) {
//Mesh variables
floatsPerVertex := 6
vertexCount := divX * divZ * 6
indiceCount := vertexCount
floats = make([]float32, vertexCount*floatsPerVertex)
indices = make([]uint32, indiceCount)
//Iteratio... |
5de24b891da7d8099fd2d2ee6dd1db64f29f1d23 | f36215d8307e5bc32790c2ce2b603732b8fdf5f2 | payfazz/go-apt | /pkg/fazzcommon/httpError/forbidden.go | Go | go | 501 | no_license | package httpError
import "net/http"
// ForbiddenError is a struct to contain forbidden http error
type ForbiddenError struct {
BaseError
}
// Forbidden is a constructor to create ForbiddenError instance
func Forbidden(err interface{}) error {
return &ForbiddenError{
BaseError: Code(http.StatusForbidden, err),
}... |
b39a878ef2d3238848b8683a122fef8553d52e00 | 00cc736c28e081fab481c2b4e0a75eca632229be | Juanfree/training | /beego/src/example/controllers/companyRead.go | Go | go | 2,149 | no_license | package controllers
import (
"example/company"
"fmt"
"github.com/astaxie/beego"
)
type CompanyRead struct {
beego.Controller
}
// @router /api/v1/company [get]
func (this *CompanyRead) GetAllCompanies(id int) {
elasticReadModel := new(company.ElasticFindAllCompanies)
companyDto, total := elasticReadModel.All... |
2720f82766975ef99f04d5c4999710d4b6348e03 | 312b7465aa757437deac0901e40a98d5fe9b30f0 | bfg-finsa/telegraf | /plugins/inputs/puppetagent/puppetagent.go | Go | go | 3,437 | permissive | package puppetagent
import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"reflect"
"strings"
"github.com/influxdata/telegraf"
"github.com/bfg-finsa/telegraf/plugins/inputs"
)
// PuppetAgent is a PuppetAgent plugin
type PuppetAgent struct {
Location string
}
var sampleConfig = `
## Location of puppet last r... |
066e882b4398011d7707134a5cdab918c803cd47 | 70775e0dfa9bfc902aea13a1dec042240fdae47d | alicht/nba-smart-contracts | /lib/go/contracts/contracts.go | Go | go | 2,674 | permissive | package contracts
//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../contracts -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../contracts
import (
"strings"
"github.com/dapperlabs/nba-smart-contracts/lib/go/contracts/internal/assets"
)
const (
topshotFile ... |
6ad5dd13876207132fc5124d4fbf49c4b39d7bda | bcea7f2f4e6d79afa6a3b779ec3d10c0b4d3c1c6 | vulturedb/vulture | /mst/base_test.go | Go | go | 951 | permissive | package mst
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLeadingZeros(t *testing.T) {
assert.Equal(t, Base2.LeadingZeros([]byte{byte(0b00001000)}), uint32(4))
assert.Equal(t, Base4.LeadingZeros([]byte{byte(0b00001000)}), uint32(2))
assert.Equal(t, Base8.LeadingZeros([]byte{byte(0b00001000)... |
84d2361cda5d6c5e3edb541601114e62f554fa6e | 7cf59dfb3ce9c8818842a3949c9bda3fcf969cbb | stationedabroad/IoT_Kafka_MQTT_Go | /workspace/mqtt_subscriber.go | Go | go | 1,748 | no_license | package main
import (
"fmt"
"encoding/json"
"log"
"net/url"
"time"
"os"
mqtt "github.com/eclipse/paho.mqtt.golang"
)
const (
Topic = "owntracks/zlaaxmtf/A481FF15-8C60-4118-BE0A-9A0E6554A63C"
// mqtt://zlaaxmtf:_rTbTI7V_Sxm@farmer.cloudmqtt.com:31352
)
func connect(clientId string, uri *url.URL) mqtt.Client... |
6cb225a26de10fb8cfc4a81f7b677e778633a2d3 | cfbde466ea7a006c175ab865a56c1ed3af553b39 | endurio/foundation-wallet | /ipc.go | Go | go | 5,389 | permissive | // Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2017 The Decred developers
// Copyright (c) 2018-2019 The Endurio developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"bufio"
"encoding/binary"
"fmt"
"io"
"os"
)
// Mess... |
18c417f5c336b2af330bfc2e17e9a1165d0a0e50 | c9059c26823db86cf5df433017d9cfa524f5939a | zhangmingkai4315/gopacket | /layers/lldp.go | Go | go | 47,404 | 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.
package layers
import (
"encoding/binary"
"errors"
"fmt"
"github.com/zhangmingkai4315/gopacket"
)
// LLDPTLVType is the... |
3755324c46966c548b283255689749cb528cad5d | 196af8e1b37fad1f000099058aee38692f57fe8a | drakkan/pipeat | /pipeat.go | Go | go | 6,797 | permissive | package pipeat
// Attempts to provide similar funcationality to io.Pipe except supporting
// ReaderAt and WriterAt. It uses a temp file as a buffer in order to implement
// the interfaces as well as allow for asyncronous writes.
// Author: John Eikenberry <jae@zhar.net>
// License: CC0 <http://creativecommons.org/pub... |
4069fd212a790b020dda9c21e440975ceccc6dcc | c427aa5f1e62182239ff0f5f9bf0fb74be467ef5 | nzbfs/go-nzbfs | /nzbfs/file_test.go | Go | go | 1,648 | no_license | package nzbfs
import (
"io"
"os"
"path"
"testing"
"bazil.org/fuse/fs/fstestutil"
)
func TestRead(t *testing.T) {
mnt, err := fstestutil.MountedT(t, &NzbFS{"testdb"})
if err != nil {
t.Error(err)
}
defer mnt.Close()
file, err := os.Open(path.Join(mnt.Dir, "hello"))
defer file.Close()
if err != nil {
... |
afec5f1b8393f7f90b88ebc2e05d56469b04a373 | e0af1b9df2de2f3024015e3f12a720fc5d0b5662 | kidmam/GoBatis | /goparser2/statement_test.go | Go | go | 1,121 | no_license | package goparser2
import (
"testing"
)
func TestStatement(t *testing.T) {
for _, test := range []struct {
name string
excepted bool
}{
{"insert", true},
{"upsert", true},
{"inserta", true},
{"upsertb", true},
{"a", false},
} {
if test.excepted != isInsertStatement(test.name) {
t.Error(test.... |
90e6544f1bfaf8c6a85e371cb88245ba9c37a190 | cca88b766a66678fd79851dbcb5a7928dc5a31cd | pedroalvesbatista/warewulf | /internal/app/wwctl/overlay/chmod/main.go | Go | go | 1,432 | permissive | package chmod
import (
"os"
"path"
"strconv"
"github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
var overlaySo... |
8b61fe42ae3af583a41929a0ed195533a0002a81 | 677a8e38ea95f39d32bc07b50fe8d18f168c2486 | master-g/texturepacker | /internal/packer/image.go | Go | go | 5,065 | permissive | // Copyright © 2019 Master.G
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distri... |
19716c8aaeff2aaba9dae92ffff2005636a3406e | edb6032811dd3bff70e808ca97a2d65122167330 | MattCurryCom/teleport | /lib/events/dynamic.go | Go | go | 11,953 | permissive | /*
Copyright 2021 Gravitational, 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... |
e462b22f1c9dabfb02cb701ff5577503129b5825 | 921e07758c4e2bb2e8d68d4bac222d24c01dd602 | ttysteale/kubernetes-api | /api/conversion.go | Go | go | 4,508 | no_license | /*
Copyright 2014 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, ... |
93f65892c7f33d6f66d89a792833be455c0e7018 | c8fa400a23a605a8f92b477ecf7dd356e82c2251 | kshenfu/kratos-blog | /internal/data/ent/schema/article.go | Go | go | 997 | permissive | package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Article holds the schema definition for the Article entity.
type Article struct {
ent.Schema
}
// Fields of the Post.
func (Art... |
21096f55f7446dc973903e3728177d6f0e89dc3e | e6d0f32d0ef8fe57496ce133622a11a48ffa8c6d | tingxin/tidb-operator | /vendor/github.com/coreos/etcd/etcdserver/api/v2store/store.go | Go | go | 19,512 | permissive | // Copyright 2015 The etcd 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 t... |
ca004ce4e68cb096edbf0153ef739669512232e5 | 1b9725c6defe7aee0826e13335bcac630d5c0a55 | r3inbowari/meeting | /rest/user_rest.go | Go | go | 753 | no_license | package rest
import (
"github.com/gorilla/mux"
"meeting/web"
"net/http"
)
// 就是个小作业, 就不搞什么验证中间件了
func LoginRest(r *mux.Router) {
r.HandleFunc("/login", web.Login).Methods(http.MethodPost) // 登录
r.HandleFunc("/login", web.Info).Methods("Get") // 登录信息
r.HandleFunc("/reg", web.Reg).Methods("Post") // 注册... |
bf3458608b0195852f494cff8369eb5d3090df04 | 0d4fd5063a7e65bfab5c18f3428600a147be1691 | yellia1989/falcon-plus | /modules/hbs/cache/plugins.go | Go | go | 1,966 | permissive | // Copyright 2017 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 in... |
4700375929a2e39a23a082b922e26e8b5d700546 | d156f38f8636fd6b630f86e5c4bf139ddb8d0f53 | Jk1484/Blog | /back/app/handlers/users/users.go | Go | go | 1,166 | no_license | package users
import (
users "blog/back/app/db/users"
"blog/back/app/libs/reply"
"database/sql"
"net/http"
"strconv"
"github.com/julienschmidt/httprouter"
"github.com/mitchellh/mapstructure"
)
// GetUser model
type User struct {
ID int `json:"id"`
Name string `json:"name"`
}
func List(w http.Response... |
7d8fdfcad6424a5704730f84b508f62b238364d4 | e446c558cb6a841fc8d642c33971b0a972e76a41 | errodrigues/fn | /fnext/listeners.go | Go | go | 5,106 | permissive | package fnext
import (
"context"
"github.com/fnproject/fn/api/models"
)
// AppListener is an interface used to inject custom code at key points in the app lifecycle.
type AppListener interface {
// BeforeAppCreate called right before creating App in the database
BeforeAppCreate(ctx context.Context, app *models.A... |
dafbc4e4236bd2db8f0410d2d2799caa9b104087 | 4d0265b963d5eb0102509d870ad9a06b1f7f633c | OpenTrustGroup/garnet | /go/src/fidl/compiler/backend/golang/templates/struct.tmpl.go | Go | go | 755 | permissive | // Copyright 2018 The Fuchsia 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 templates
const Struct = `
{{- define "StructDefinition" -}}
type {{ .Name }} struct {
_ struct{} ` + "`" + `fidl2:"s,{{ .Size }},{{ .Alignment }... |
02e8b9c2e35251ff42e07eed94132d370f8a0c52 | 4c094bd178cd1c55134021b0d01d2c40ecad2787 | wkoe/bullet | /restart.go | Go | go | 683 | permissive | package main
import (
"log"
"github.com/FurqanSoftware/bullet/core"
"github.com/FurqanSoftware/bullet/spec"
"github.com/spf13/cobra"
)
var RestartCmd = &cobra.Command{
Use: "restart",
Short: "Restart application in server",
Long: `This command restarts the application in the server.`,
Run: func(cmd *cobra... |
21e536894332c9c006e923e0065ab29b3b0b63c4 | f83c78e2d7c46f5fc3f9966e0ed693d3fa46737e | codyhoag/windows-machine-config-bootstrapper | /tools/windows-node-installer/pkg/cloudprovider/azure/vm.go | Go | go | 51,268 | permissive | package azure
import (
"context"
"encoding/base64"
"errors"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"github.com/Azure/azure-sdk-for-go/profiles/2019-03-01/resources/mgmt/resources"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-0... |
a4766d6d9cfa32b31cae340759f2cd21e04a377b | 1c703d392c15caa46f01ef4d107f24abce757ce8 | Saurabhsharma009/cfdev | /cmd/version/version_test.go | Go | go | 5,665 | permissive | package version_test
import (
"code.cloudfoundry.org/cfdev/workspace"
"fmt"
"path/filepath"
"code.cloudfoundry.org/cfdev/cmd/version"
"code.cloudfoundry.org/cfdev/cmd/version/mocks"
"code.cloudfoundry.org/cfdev/config"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"io... |
be840183da74752b61408c6c3c3c9446b00421ef | 734c30894cf98fcda4b47dbad48f1a27faeae1f5 | dagons/go-categories | /pkg/setting/setting.go | Go | go | 1,045 | no_license | package setting
import (
"github.com/go-ini/ini"
"log"
"time"
)
var (
Cfg *ini.File
RunMode string
HTTPPort int
ReadTimeout time.Duration
WriteTimeout time.Duration
PageSize int
JwtSecret string
)
func init() {
var err error
Cfg, err = ini.Load("conf/app.ini")
if err != nil {
log.Fatal("Fail ... |
598280302d60d6a5e4f5f1aee42f00d11ec2bf94 | 35144b1833f6e6f10b2c0551b5ef2f0f56f3f215 | morrell/pulumi-azure-native | /sdk/go/azure/network/v20160330/virtualNetworkGateway.go | Go | go | 15,565 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20160330
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A common class for general resource i... |
6a4beceece8deaaefeaba662350b3065bef11392 | d3e5f7f0d63583e921032acb704d419a106fcf5a | BytemarkHosting/bytemark-client | /lib/brain/types_json_test.go | Go | go | 4,775 | permissive | package brain
import (
"encoding/json"
"fmt"
"net"
"testing"
"github.com/cheekybits/is"
)
var (
fixtureDiscOne = `{
"id": 99994,
"label": "vda",
"size": 35840,
"storage_grade": "sata",
"storage_pool": "tail99-sata9",
"type": "application/vnd.bigv.disc",
"virtual_machine_id": 99999
}... |
8db2104d1ac98791fc376ab0f6c5e54504c909ee | 8f9002dac5df8f2517656bfcb1d07ffd8d0e6632 | tonywangcn/LeetCode | /Algorithms/0009.palindrome-number/palindrome-number.go | Go | go | 235 | permissive | package problem0009
func isPalindrome(x int) bool {
if x < 0 || (x != 0 && x%10 == 0) {
return false
}
reversed := 0
for x > reversed {
reversed = reversed*10 + x%10
x = x / 10
}
return x == reversed || x == reversed/10
}
|
9b0cb566cb5a3cbb27d7dc92e49d6c2be72f5540 | 64e726241fc2219048cff61a07de95bd15705aea | coreos/mantle | /storage/storage.go | Go | go | 899 | permissive | // Copyright 2016 CoreOS, 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... |
586ede43104e03cfa3782ed717fd716d218b4cdd | 735335d922f1178a648f5bebd46f7ce513f118e4 | prajwal714/Simple-Todo | /contracts/users.go | Go | go | 282 | no_license | package contracts
import "time"
type User struct {
ID int64 `json:"id"`
UUID string `json:"uuid"`
Email string `json:"email"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt time.Time `json:"deletedAt"`
}
|
cc138d0ae3be55ed229c7aca923f92ed406ba6c3 | 80c874d04c7081b7c035c8eeddc63c6725f95b07 | esturcke/cryptopals-golang | /challenge7.go | Go | go | 916 | permissive | package cryptopals
import (
"crypto/aes"
"github.com/esturcke/cryptopals-golang/crypt"
"github.com/esturcke/cryptopals-golang/io"
"github.com/esturcke/cryptopals-golang/bytes"
)
/*
AES in ECB mode
See https://cryptopals.com/sets/1/challenges/7
The Base64-encoded content in this file (https://cryptopals.com/s... |
0b1f9f900556bd7dd47d6d16fc8882a98ff4395f | f4753d37d3b90ad9fe39fa5dd9adaddb18b76c58 | yangjiu/reserve-data | /blockchain/blockchain.go | Go | go | 23,287 | permissive | package blockchain
import (
"context"
"errors"
"fmt"
"log"
"math"
"math/big"
"strconv"
"strings"
"time"
"github.com/KyberNetwork/reserve-data/common"
ether "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
ethereum "github.com/ethereum/go-ethereum/common"
"github.com/... |
227ccd8ab88c3c0715fd751b77b0dee76f88b076 | ed1fdfb7b8c334acd385119803a7d1509892af27 | shieldproject/shield | /client/v2/shield/passwd.go | Go | go | 305 | permissive | package shield
func (c *Client) ChangePassword(oldpw, newpw string) (Response, error) {
var r Response
in := struct {
OldPassword string `json:"old_password"`
NewPassword string `json:"new_password"`
}{
OldPassword: oldpw,
NewPassword: newpw,
}
return r, c.post("/v2/auth/passwd", in, &r)
}
|
fcc6fc1fe2f9bf447b66d204427ad5e14e956cfb | 56f72f76f8fad8cf8aca3b76c1459c047cd8fc43 | yushanjin/dry | /vendor/github.com/docker/docker/libcontainerd/container_windows.go | Go | go | 10,853 | permissive | package libcontainerd
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"strings"
"syscall"
"time"
"github.com/Microsoft/hcsshim"
"github.com/sirupsen/logrus"
"github.com/docker/docker/pkg/system"
"github.com/opencontainers/runtime-spec/specs-go"
)
type container struct {
containerCommon
// Platform spec... |
c11b2931105bcef4e92239a95d699ac326cb4b21 | 2c2e0a5304e939a6a5f1b65c608db265be40b4f5 | st-fresh/go-pgpmail | /pgpmessage/armor.go | Go | go | 1,852 | permissive | package pgpmessage
import (
"bufio"
"bytes"
"io"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor"
)
// Armored type for PGP encrypted messages.
const pgpMessageType = "PGP MESSAGE"
var armorTag = []byte("-----BEGIN "+pgpMessageType+"-----")
func decryptArmored(in io.Reader, kr openpgp.KeyRing... |
11b28121577d877e12cbac77636107a96aaeb8f5 | 563e0b5538768f2678febf767c9887556a63e070 | AfKurniawan/notifi-backend | /src/tracer/tracer.go | Go | go | 1,188 | permissive | package tracer
import (
"context"
"fmt"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/propagation"
"go.opentelemetry.io/otel/api/trace"
"net/http"
)
func Middleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
span := GetInject... |
b436ab497cbdf3caadf65ac5947949371bad7964 | 02033c13d74844538a2e8bb3a628ddb85d41e2e1 | eloycoto/gloo | /pkg/cliutil/nsselect/select.go | Go | go | 4,226 | no_license | package nsselect
import (
"fmt"
"github.com/solo-io/gloo/pkg/cliutil"
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
"gopkg.in/AlecAivazis/survey.v1"
)
//NOTE these functions are good candidates for code generation
func ChooseResource(typeName string, menuDescription string, nsr NsResourceMap) (core.Re... |
5f2de6f3c11fa0a6bfd254f7ad0106e06eee144b | bf1c5e22bb857f8f3b20d8b9d673b901dbaaae00 | amitsaha/yawsi | /cmd/tfGeneralNaclRules.go | Go | go | 3,630 | permissive | package cmd
import (
"errors"
"fmt"
"log"
"net"
"os"
"path"
"reflect"
"text/template"
"github.com/BurntSushi/toml"
"github.com/spf13/cobra"
)
var subnetName string
type naclRulesSpec struct {
SubnetName string `toml:"subnet_name"`
Rules []naclRule
}
type naclRule struct {
NetworkACLID string `tf:... |
5c73c6c2a3c807139292473739b5df02a5ee01bd | e5c44491f7ed53e7c64906934e67d8bc82d0cc40 | Eacred/eacrd | /rpc/jsonrpc/types/chainsvrwsntfns_test.go | Go | go | 7,198 | permissive | // Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package types
import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"testing"
"github.com/Eacred/eacrd/dcrjson"
)
// Test... |
dca5c97c9a94517532f0e01f38f8d8e94c6652e6 | e2e651defae11f97262b6e8072a8e3fa28008801 | yannizhang2019/ibm-commonui-operator | /pkg/controller/commonwebuiservice/commonwebuiservice_controller.go | Go | go | 34,935 | permissive | //
// Copyright 2021 IBM 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 law or agreed to ... |
2b63e8980c645aad0ac3eba1b05be6ab8b3dded4 | c69b44f3c0aaff7a5b52e3a8eb9edc466729d4bb | rickar/cal | /v2/ie/ie_holidays.go | Go | go | 2,963 | permissive | // (c) Rick Arnold. Licensed under the BSD license (see LICENSE).
// Package ie provides holiday definitions for the Republic Of Ireland.
package ie
import (
"time"
"github.com/rickar/cal/v2"
"github.com/rickar/cal/v2/aa"
)
var (
// NewYear represents New Year's Day on 1-Jan
NewYear = aa.NewYear.Clone(&cal.Hol... |
332edddc1a9b2549f040db93274bda76240427a5 | 30d32fe07ec0a8ea23f5229d3244bbdc0e2cfc52 | square/keysync | /cmd/monitor/fixtures_test.go | Go | go | 3,242 | permissive | package main
const testClientCert = `
-----BEGIN CERTIFICATE-----
MIIEIzCCAgugAwIBAgIQfAw6Uerc57T8oeb++YNJjTANBgkqhkiG9w0BAQsFADAS
MRAwDgYDVQQDEwd0ZXN0LWNhMB4XDTE5MDYwNTIzNTIyN1oXDTIwMTIwNTIzNTIw
OVowFjEUMBIGA1UEAxMLdGVzdC1jbGllbnQwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQDXVzsZZ1DgwU8cyryTM6hgKzvJu38rvl5iRM+LX2p/sO... |
687d489b9790a00d9bf158dbd2691bc47d47f793 | 303638de5bb5d832e02e0a5ec03ca138fb917578 | rogervaas/aws-operator | /service/controller/clusterapi/v29/resource/tcnpoutputs/create.go | Go | go | 3,147 | permissive | package tcnpoutputs
import (
"context"
"fmt"
"github.com/giantswarm/microerror"
"github.com/giantswarm/aws-operator/service/controller/clusterapi/v29/cloudformation"
"github.com/giantswarm/aws-operator/service/controller/clusterapi/v29/controllercontext"
"github.com/giantswarm/aws-operator/service/controller/c... |
3deb0cbca204ec154f95cd9785fca75028720079 | d8720032d632ac5f9f00aea4fbc936a556529fa2 | Rachelwwwwb/TPC | /Round4/D/d.go | Go | go | 5,500 | no_license | package main
import (
"bufio"
"container/heap"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func ReadLine(reader *bufio.Reader) string {
line, _ := reader.ReadString('\n')
return strings.TrimRight(line, "\n")
}
func ReadInt(reader *bufio.Reader) int {
num, _ := strconv.Atoi(ReadLin... |
ec1b44d851a389124b3821aad6c017282ea89ed2 | efb19cc4d0a59df910670b91595ccc6a72e22521 | cephurs/mygo | /myyy/src/availserverd/main.go | Go | go | 3,163 | no_license | package main
import (
"github.com/ChenLong-dev/gobase/mbase"
"github.com/ChenLong-dev/gobase/mlog"
"myyy/src/availserverd/config"
//"myyy/src/availserverd/etcd"
"github.com/ChenLong-dev/gobase/etcd"
"myyy/src/availserverd/etcd/discovery"
"os"
"time"
)
var (
PointBound int
RegionBound int
Det... |
59ad0eeed5bb305bf480469da99f66fc09462199 | eb87a76f522a8632c9ea9bf957590e1bca40161b | lmartinezsch/lifepolls-back | /pkg/api/v1.0/post/postController.go | Go | go | 3,017 | permissive | package post
import (
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
"github.com/lmartinezsch/lifepolls-back/pkg/database/models"
"github.com/lmartinezsch/lifepolls-back/pkg/lib/common"
)
// Post type alias
type Post = models.Post
// User type alias
type User = models.User
// Auth type alias
type Auth = mo... |
67a4cd6e876ee224f7130904f8ff39497ac7be78 | 2fa0f8141e9367cc04771a39c46df0f064e3ee7f | msecret/cg-dashboard | /acceptance/user_login_test.go | Go | go | 1,652 | permissive | // +build acceptance
package acceptance
import (
. "github.com/AusDTO/cg-dashboard/acceptance/util"
. "github.com/AusDTO/cg-dashboard/acceptance/views"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sclevine/agouti"
. "github.com/sclevine/agouti/matchers"
"net/http/httptest"
)
var _ = Desc... |
f7ee17f835c39edea6c66c823de4cbf3eb2b0b68 | fb396bca56a099d13350d7bc3f6b9f88251af923 | skuid/helm-value-store | /vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper_test.go | Go | go | 19,860 | permissive | /*
Copyright 2015 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, ... |
b837cafeb9657352faaa4962a721f018e6d26c21 | 3e2767dd8aa4411adcd66eae39421482c6a676b9 | paulyc/x | /cmd/dnsd/main.go | Go | go | 3,572 | permissive | // Command dnsd is a simple DNS server for my network. It has O(n) lookup times.
package main
import (
"bufio"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/miekg/dns"
"github.com/mmikulicic/stringlist"
"within.website/x/internal"
"within.website/x/web"
)
var (
port = fl... |
94375ee9a0bed6644d95f38dc2e3ced5b05e69a8 | ddd5101953da6f7a201d44895ddf175db511adcc | dmitsh/dcos-engine | /pkg/api/vlabs/validate.go | Go | go | 14,796 | permissive | package vlabs
import (
"errors"
"fmt"
"net"
"net/url"
"regexp"
"github.com/Azure/dcos-engine/pkg/api/common"
validator "gopkg.in/go-playground/validator.v9"
)
var (
validate *validator.Validate
keyvaultIDRegex *regexp.Regexp
labelValueRegex *regexp.Regexp
labelKeyRegex *regexp.Regexp
)
const (
... |
c27b301b2bf5e95384bb5f9c6b6e30501698eaa2 | c01f22b671fd2bf7587262e7176423cfb7db8b8d | ColbySong/BlockArt | /ink_miner_test.go | Go | go | 10,984 | no_license | package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"./blockartlib"
"./blockchain"
"testing"
"reflect"
"strings"
)
const GENESIS_BLOCK_HASH = "83218ac34c1834c26781fe4bde918ee4"
const RANDOM_NONCE = 1 // just putting a random nonce in the block since we are not testing it
const SVG_OP_ONE = ... |
42c34b12302830288719ed1558cf25c513128200 | c6cc91eba039b207adc7ef3b240102ff082e1fb2 | onekung/grpc2way | /server.go | Go | go | 2,361 | permissive | package main
import (
"context"
"crypto/tls"
"fmt"
"grpc2way/packet"
"log"
"math/rand"
"net"
"time"
"github.com/hashicorp/yamux"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
)
//RunServer -
func RunServer(addr string) {
lis, err := net.Listen("tcp"... |
3d69344ca31bb6df3214950bd263856f30c67fcb | c271af03d952e7ef6ffab78e2aecaaa0010e758b | eazow/knowledge-hierarchy | /go/examples.go | Go | go | 1,352 | no_license | // Single line comment
/* Multi-
line comment */
/* A build tag is a line comment starting with // +build
and can be executed by go build -tags="foo bar" command.
Build tags are placed before the package clause near or at the top of the file
followed by a blank line or other line comments. */
// +build prod, de... |
cba81e8a3ac7a1ef3cf8e19b74372e28f20c132d | acec4584e49043dd44d7040da775f83fbd246ce7 | sld880311/k8s | /kubernetes/pkg/version/base.go | Go | go | 2,917 | permissive | /*
Copyright 2014 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, ... |
03f375c4dc4fd3352a0238a6423b646c54c649f9 | d3a9b45558248073576e5a93c21d257c1f6c07cf | wi-cuckoo/fungo | /leetcode/one/166_fractionToDecimal.go | Go | go | 1,131 | no_license | /*
给定两个整数,分别表示分数的分子 numerator 和分母 denominator,以字符串形式返回小数。
如果小数部分为循环小数,则将循环的部分括在括号内。
示例 1:
输入: numerator = 1, denominator = 2
输出: "0.5"
示例 3:
输入: numerator = 2, denominator = 3
输出: "0.(6)"
*/
package one
import "strconv"
func fractionToDecimal(x int, y int) string {
if x == 0 {
return "0"
... |
584046ea68cdf365d9421f8ad98e813b8b4979a0 | 6a53e78de04ecc7988928798d75b49f9b78390c0 | unsafe-risk/go-alrescha | /parsershared/shared.go | Go | go | 398 | permissive | package main
import "C"
import (
"encoding/json"
"github.com/unsafe-risk/go-alrescha/parser"
)
func main() {
}
//export ParseIDL
func ParseIDL(data []byte) (output string, returnCode int) {
info, err := parser.ParseGenerateInfo(data)
if err != nil {
return "", -2
}
GenDatas, err := json.MarshalIndent(info... |
c521711a2baf3535a78db12a8c6cef3887b17612 | ef1288fb67e23bf1c6431c4bfc1a77f4c38c3ac8 | EvanXzj/the-way-to-go | /chapter12/examples/read_file2.go | Go | go | 472 | no_license | package main
import (
"fmt"
"os"
)
func main() {
file, err := os.Open("./chapter12/examples/products2.txt")
if err != nil {
panic(err)
}
defer file.Close()
var col1, col2, col3 []string
for {
var v1, v2, v3 string
_, err := fmt.Fscanln(file, &v1, &v2, &v3)
// scans until newline
if err != nil {
... |
6de394a217f23dc4f87059bc0e6ad4d1c125caf3 | 7777183b416ed7dfa48227471de92bb339e3f09d | DropFan/go-sqlbuilder | /defines.go | Go | go | 706 | permissive | package builder
// SQLType ...
type SQLType int
const (
// RawSQL ...
RawSQL SQLType = iota + 1
// SelectSQL ...
SelectSQL
// InsertSQL ...
InsertSQL
// ReplaceSQL ...
ReplaceSQL
// InsertOrUpdateSQL ...
InsertOrUpdateSQL
// UpdateSQL ...
UpdateSQL
// DeleteSQL ...
DeleteSQL
)
// func (f *FieldValue) S... |
6ea0a311821a08e7a6db6510cb915d89903ee35e | aae6f05a247fd4dbd9a4efa3beddea211ca7ec47 | apuigsech/btcrpcclient | /chain.go | Go | go | 16,688 | permissive | // Copyright (c) 2014-2015 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package btcrpcclient
import (
"bytes"
"encoding/hex"
"encoding/json"
"github.com/btcsuite/btcd/btcjson/v2/btcjson"
"github.com/btcsuite/btcd/wire"
"github.com/btc... |
851f4871335346ba12102415d165a08b927af369 | 152d59d69b9dce9a2a618e4144c9ad9722409e0c | standy66/go-casify | /fuzzing_gen.go | Go | go | 4,295 | permissive | // The following directive is necessary to make the package coherent:
// +build ignore
// This program generates fuzzing_test.go. It can be invoked by running
// go generate
package main
import (
"log"
"math/rand"
"os"
"strings"
"text/template"
"time"
"unicode"
)
var stringCases []string = []string{
"SnakeC... |
1454e553d92da847e123b5e40a6a1d9b6b03a5ae | 8ceac222c0d7b69aeeeeb07482c5898caca45409 | ChinaArJun/fabric-gm | /fabric-gm/internal/configtxgen/metadata/metadata_test.go | Go | go | 660 | permissive | /*
Copyright 2017 Hitachi America
SPDX-License-Identifier: Apache-2.0
*/
package metadata_test
import (
"fmt"
"runtime"
"testing"
"github.com/VoneChain-CS/fabric-gm/internal/configtxgen/metadata"
"github.com/stretchr/testify/assert"
)
func TestGetVersionInfo(t *testing.T) {
testSHAs := []string{"", "abcdefg"... |
c4274072ca6ab0bd2a73a77c959029cf2dd54f81 | ea6d0deff5f961138b29ac1f8cdbf940ad85b47f | corestario/modules | /incubator/nft/app/app.go | Go | go | 11,076 | permissive | package simapp
import (
"io"
"os"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.co... |
af42cace0d9f0a6736c5999bc99569c2722c6358 | ae280051622436de339fa6d9e83220b1cae788ab | Johan-An/go-practise | /practise21.go | Go | go | 331 | no_license | /*
* @Description:
* @Author: XiaoAn
* @Date: 2021-02-19 15:22:00
* @LastEditTime: 2021-02-19 15:25:54
* @LastEditors: XiaoAn
*/
package main
import "fmt"
type A struct {
a int
}
type B struct {
a int
}
type C struct {
A
B
}
func main() {
c := &C{}
c.A.a = 15
// c.a = 15
fmt.Println(c.A.a)
// fmt.Prin... |
1732b2424d54db8a0447d3a9597df6f3e759a59b | e8ff5708dbb91360b67c2c3d94d8ff3842ad4d3c | Nistagram-Organization/Agent-Application | /agent-reports/src/controllers/product_report/product_report_controller.go | Go | go | 701 | permissive | package product_report
import (
"github.com/Nistagram-Organization/Agent-Application/agent-reports/src/services/product_report"
"github.com/gin-gonic/gin"
"net/http"
)
type ProductReportsController interface {
GenerateReport(ctx *gin.Context)
}
type productReportsController struct {
productReportsService produc... |
229ff1545cd326fd23225325bed477bac29102ae | 591d184d1b2896070f396b2b4d2e94247f85da8d | ultracodein/go_core | /go_lesson_18/websocket/pkg/api/api.go | Go | go | 3,072 | no_license | package api
import (
"net/http"
"sync"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
)
// API реализует программный интерфейс сервера обмена сообщениями
type API struct {
router *mux.Router
upgrader websocket.Upgrader
secret string
msgs chan string
pool []chan string
}
// New - констр... |
2351fdee05743544c77c4cd0163c6a294c2d06fb | 963fc7676da0dbebffcdc0dab1492cb92b356bcc | yeya24/tiup | /pkg/cluster/ctxt/context.go | Go | go | 5,160 | permissive | // Copyright 2021 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
848b223854b60d203d17d08a5d8b62abbf62f3eb | 1879e76c738f60baef68cdd4414dc261cf82ae28 | tendermint/tendermint | /test/maverick/node/privval.go | Go | go | 10,778 | permissive | package node
import (
"errors"
"fmt"
"os"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmjson "github.com/tendermint/tendermint/libs/json"
tmos "github.com/tendermint/tendermint/libs/os"
"github.com/tendermin... |
e96145e155f974574407c233693754cbcc972419 | 3b4327dd1f0cc8d9cc1b3c5a75e8dfdaf0152dce | rainboat2/BaiduPCS-Go | /requester/uploader/instance_state.go | Go | go | 1,254 | permissive | package uploader
import (
"github.com/qjfoidnh/BaiduPCS-Go/requester/transfer"
)
type (
// BlockState 文件区块信息
BlockState struct {
ID int `json:"id"`
Range transfer.Range `json:"range"`
CheckSum string `json:"checksum"`
}
// InstanceState 上传断点续传信息
InstanceState struct {
BlockL... |
3d2d7f73dd1a5f0a1cee2cbb4387d75c1a21bfbf | 750eaac32414263b73115bec83073fd17437d1f1 | Garykom/wide | /output/vet.go | Go | go | 3,477 | permissive | // Copyright (c) 2014-2019, b3log.org & hacpai.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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... |
99cd55cd4a8162d4bdc01a251ba401278dee9755 | 1248c22e6cadbaf757273d6cbe3940013da28985 | insanejudge/nomad-helper | /gc.go | Go | go | 259 | permissive | package main
import (
log "github.com/Sirupsen/logrus"
)
func gcCommand() error {
client, err := NewNomadClient()
if err != nil {
return err
}
err = client.System().GarbageCollect()
if err != nil {
return err
}
log.Info("Done!")
return nil
}
|
9e15f29e71b7f2bd9098902fe6a7194cdf31f7fd | f706985b97a167961d9003da0f1fe4e8fcbc941d | gnboorse/gate | /pkg/gate/proto/proto.go | Go | go | 5,181 | permissive | package proto
import (
"errors"
"fmt"
"io"
"reflect"
"strconv"
)
// Indicates a packet was known and successfully decoded by it's registered decoder,
// but the decoder has not read all of the packet's bytes.
//
// This may happen in cases where
// - the decoder has a bug
// - the decoder does not handle the c... |
45f573f2911090d9d56b1babdf99998f8ec3a53d | 87d994c8d9ede0f2d34e95b74cc79a40fee4ec2c | zigbee-alliance/distributed-compliance-ledger | /x/compliance/types/genesis_test.go | Go | go | 4,127 | permissive | package types_test
/*
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/zigbee-alliance/distributed-compliance-ledger/x/compliance/types"
)
func TestGenesisState_Validate(t *testing.T) {
for _, tc := range []struct {
desc string
genState *types.GenesisState
valid bool
}{
{
d... |
4a218f70ddc07123bb9f54542737d8fe9c908f9d | 871e4eff6efc8790be7f67e793651954b30ad24e | neymanroman/go-tour | /exercise-fibonacci-closure.go | Go | go | 423 | no_license | package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
result, step := 0, 0
return func() int {
tmp := result
result = step
step = result + tmp
if result == 0 {
step = 1
return 0
} else if result == 1 {
return 1
}
... |
6aff1f7617de77958e1e40c713c2cf12caf5a14c | 1f093ba23d99f5243abdb083157b41b2254d6436 | denen99/cli | /pkg/app/run_test.go | Go | go | 26,497 | permissive | package app_test
import (
"bytes"
"io"
"strings"
"testing"
"github.com/fastly/cli/pkg/api"
"github.com/fastly/cli/pkg/app"
"github.com/fastly/cli/pkg/config"
"github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/mock"
"github.com/fastly/cli/pkg/testutil"
"github.com/fastly/cli/pkg/update"
)
func T... |
69396a7a25f1337e969861391e48e09ba1262ab8 | 3302c5e4deeed67d9c79f5c11cb1aae01f49af31 | gonum/gonum | /graph/graph.go | Go | go | 8,848 | permissive | // Copyright ©2014 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package graph
// Node is a graph node. It returns a graph-unique integer ID.
type Node interface {
ID() int64
}
// Edge is a graph edge. In directed grap... |
4746d9fe391a471aebe8f453776a431f4136a8ad | 87e437aa15dace123696b2f9dd9bdd3c03f83cb9 | go-training/training | /example23-deploy-go-application-with-up/main.go | Go | go | 631 | permissive | package main
import (
"os"
"github.com/gin-gonic/gin"
)
func main() {
port := ":" + os.Getenv("PORT")
stage := os.Getenv("UP_STAGE")
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong " + stage,
})
})
r.GET("/v1", func(c *gin.Context) {
c.JSON(200, gin.H{
"... |
9b1cfc84812dd561cece87b55a73114570cb6907 | 07dbd75b0f584c6eb4c9040b21840ebed5d5ee9e | anders0913/luci-go | /cipd/client/cipd/plugin/admission/example/main.go | Go | go | 2,633 | permissive | // Copyright 2020 The LUCI 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... |
6af5c1e0c3ed06af4ffa5b3c5bd2fcf752c60347 | 5e191990116fa425563f701f3bff52c48f063985 | naorgu/m3 | /src/aggregator/aggregator/timer_elem_gen.go | Go | go | 15,909 | permissive | // Copyright (c) 2021 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
e28a544b508b0b520c95ee1a853e608481f2b291 | 53b391b22f6e0be1983e9d68d7630de94cd55aa4 | cajbecu/cadence | /common/persistence/persistence-tests/historyPersistenceTest.go | Go | go | 13,187 | permissive | // Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
b60a55245e3fbd378c3bf30a03500472aeae4049 | b0aee2805443f55691f1566bcda148ba35f3c650 | go-skei/skei | /routers/home.go | Go | go | 9,688 | permissive | // Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package routers
import (
"bytes"
"strings"
"code.skei.dev/skei/models"
"code.skei.dev/skei/modules/base"
"code.skei.dev/skei/modules/context"
"code.sk... |
fa971b1268b715bf81162ae69504154ef926301d | b54b566dbd0320fe957a4ba41319c5fde670189f | PsymonLi/sw | /iota/test/venice/iotacmd/cmd/upgrade.go | Go | go | 6,807 | no_license | package cmd
import (
"errors"
"fmt"
"os"
"time"
constants "github.com/pensando/sw/iota/svcs/common"
"github.com/pensando/sw/iota/test/venice/iotakit/model"
"github.com/pensando/sw/iota/test/venice/iotakit/model/common"
"github.com/pensando/sw/iota/test/venice/iotakit/model/objects"
Testbed "github.com/pensan... |
4c4f1ebf385af3780a6cf8106b54132732b4697a | cb93bd7fb21c413ce28b3e17e1bca9e28a580e0d | coreos/tectonic-installer | /tests/smoke/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider.go | Go | go | 3,739 | permissive | /*
Copyright 2014 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, ... |
a29447d8e87e7b56067439f40f1f532b71ced901 | 99cd80bb0bf72e3f24ee84d69af3398b1ef333df | dooman87/go-intro | /slices.go | Go | go | 402 | permissive | package intro
import "fmt"
func Slices() {
slice := make([]int, 0)
slice = append(slice, 9, 8, 7, 6, 5, 4, 3, 2, 1)
fmt.Printf("%v\n", slice[8])
fmt.Printf("%v\n", slice[3:5])
fmt.Printf("%v\n", slice[7:])
//Delete 2nd element
slice = append(slice[:1], slice[2:]...)
fmt.Printf("%v\n", slice)
fmt.Printf("le... |
446eebc7c6c99bd7f517de771c6f35bde32fe808 | 24a5f0080dd922aa0e8dd5471d351d1572546af3 | trucyber/tru-p2p | /routed/broadcast.go | Go | go | 7,213 | no_license | package main
import (
"bufio"
"context"
"crypto/rand"
"flag"
"fmt"
"log"
"os"
"strings"
"io"
// mrand "math/rand"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/... |
b64fc92f890aa71666ee7b47642b168161f9c329 | fbcc2105797025cd1fb0704f3402888dfb8cfd5f | blurty/beego-blog | /models/usermodel.go | Go | go | 2,461 | no_license | package models
import (
"time"
"github.com/astaxie/beego/orm"
)
type UserLoginRequest struct {
Username string `json:"username"`
Email string `json:"email"`
Password string `json:"password"`
Token string `json:"token"`
}
type UserLoginResponse struct {
Username string `json:"username"`
Email string... |
dadfc70865cf03208d0e8c8711d39a763453ac1e | 8435dd53e945350bda84101ca8f7f9df9727dce4 | frou/stdext | /regexp.go | Go | go | 1,554 | permissive | package stdext
import (
"errors"
"regexp"
)
// ExtractNamedMatches tries to match the regular expression exp once in s and
// returns a map with keys which are the subexpression names in exp
// (?P<example>...) and values which are the matched values of those
// subexpressions.
func ExtractNamedMatches(
exp string... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.