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 |
|---|---|---|---|---|---|---|---|---|
45d9e1a3f0677ac19b64027330ce559084aa529d | eefef46f61fbb1693d891fa1dfa9c39d4752b7f7 | BrainBot/advent | /2016/p2/p2.go | Go | go | 1,890 | permissive | package main
import (
"fmt"
"io/ioutil"
"strconv"
"strings"
//"bufio"
)
type pair struct {
x, y int
}
func main() {
keypad := [][]int{}
row1 := []int{-1, -1, 1, -1, -1}
row2 := []int{-1, 2, 3, 4, -1}
row3 := []int{5, 6, 7, 8, 9}
row4 := []int{-1, 0xA, 0xB, 0xC, -1}
row5 := []int{-1, -1, 0xD, -1, -1}
key... |
22ac62e8dd3809c522605abdf0866bc49ca21319 | f18fa3ccd7da11a2c2ff98d48de9f0b4dc28e28c | zhaofengli/seaweedfs-csi-driver | /pkg/driver/mounter.go | Go | go | 1,514 | permissive | package driver
import (
"fmt"
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
"os/exec"
"k8s.io/utils/mount"
)
// Config holds values to configure the driver
type Config struct {
// Region string
Filer string
}
type Mounter interface {
Mount(target string) error
}
func newMounter(bucketName stri... |
36dce5ab35025303f4433d9c4206423f9f3e3bba | c9c8383a9382bb68e9fa337cd68d4ce3ba7cb837 | isabella232/theatre | /apis/vault/v1alpha1/secretsinjector_webhook.go | Go | go | 13,074 | permissive | package v1alpha1
import (
"context"
"encoding/json"
"fmt"
"net/http"
"path"
"strings"
"time"
"github.com/go-logr/logr"
"github.com/mitchellh/mapstructure"
"github.com/prometheus/client_golang/prometheus"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/controller-runtime/pk... |
198b26792f5bbb8174699c8eb8bba305e08267e1 | a32a6772851660bbcdd090076cdb113b4f74d47a | bpkgoud/pulumi-azure-native | /sdk/go/azure/apimanagement/v20200601preview/emailTemplate.go | Go | go | 5,458 | permissive |
package v20200601preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type EmailTemplate struct {
pulumi.CustomResourceState
Body pulumi.StringOutput `pulumi:"body"`
Description pulumi.StringPtrOutput ... |
ef42aad8df6d0053d563afbd0991f71b2c3d6863 | f2c45d0e1c7a2e7edc80167111385d44f4cf525c | ptoews/syncflux | /pkg/agent/agent.go | Go | go | 7,473 | permissive | package agent
import (
"sync"
"time"
"github.com/sirupsen/logrus"
"github.com/toni-moreno/syncflux/pkg/config"
)
var (
// Version is the app X.Y.Z version
Version string
// Commit is the git commit sha1
Commit string
// Branch is the git branch
Branch string
// BuildStamp is the build timestamp
BuildStam... |
802c6bbe72e70896145f01aa797b8f2c9e25ab82 | c054c93b85e20d8799a1139e5f762e7d3b2a206b | FoodHubOrg/Food-Hub-API | /internal/domain/menu/model.go | Go | go | 367 | no_license | package menu
import (
"foodhub-api/internal/database"
"foodhub-api/internal/domain/food"
uuid "github.com/satori/go.uuid"
)
type Menu struct {
database.Base
Name string `gorm:"type:varchar(100);not_null;"`
RestaurantID uuid.UUID `gorm:"type:uuid;not_null;"`
UserID uuid.UUID `gorm:"type:uuid;not_null;"`
Foods... |
dbfa7cce13635e93a9473dbaf849a925d0e38da1 | 2e48d0ee13955595b54e623d744766998a939bfb | ShuangMen/quarks-operator | /pkg/bosh/bpmconverter/resources.go | Go | go | 18,064 | permissive | package bpmconverter
import (
"strconv"
"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
batchv1b1 "k8s.io/api/batch/v1beta1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
qjv1a1 "code.cloudfoundry.org/quarks-job/... |
655fc1753cbbfd0e56ce1ff5e5b8e7de9ca93f79 | 29a482a2d49fea88a46388d7822991174b1678f0 | m-almas/alem-journey | /btreeapplypostorder.go | Go | go | 267 | no_license | package piscine
//BTreeApplyPostorder ...
func BTreeApplyPostorder(root *TreeNode, f func(...interface{}) (int, error)) {
if root.Left != nil {
BTreeApplyPostorder(root.Left, f)
}
if root.Right != nil {
BTreeApplyPostorder(root.Right, f)
}
f(root.Data)
}
|
c42c9c16352ff4bb1a977edf2a180eb5183d5f80 | 33c2a8381b817d1df2c30272eb1c9ff29ed9def1 | k15r/kyma | /tests/function-controller/testsuite/config.go | Go | go | 1,449 | permissive | package testsuite
import (
"time"
"github.com/kyma-project/kyma/tests/function-controller/pkg/step"
)
const (
TestDataKey = "testData"
)
type Config struct {
Namespace string `envconfig:"default=test-function"`
KubectlProxyEnabled bool `envconfig:"default... |
72f42653d984f7a840ded899d40a65d448ba24e8 | b4e735335d9d80379b8a5b6b73873a37ec4202fd | urjitbhatia/unik | /pkg/providers/openstack/delete_image.go | Go | go | 1,607 | permissive | package openstack
import (
"fmt"
"github.com/emc-advanced-dev/pkg/errors"
"github.com/solo-io/unik/pkg/types"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/imageservice/v2/images"
)
func (p *OpenstackProvider) DeleteImage(id string, force bool) error {
image, err := p.GetImage(i... |
3fbf61b03e09e91ac029d0d6493584b12ea45376 | 243c1c033062d19efeb0c061059697d5a4932bb1 | intuit/foremast | /foremast-barrelman/vendor/k8s.io/apiserver/pkg/apis/example/types.go | Go | go | 5,203 | 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, ... |
e006bf61ceed560ccf8546702755ffba8e5f9e84 | e08678be7e0870029c63e18259632e82e55c1bb1 | tjoluotch/golang-learning | /if-else.go | Go | go | 447 | no_license | package main
import "fmt"
func main() {
if 7%2 == 0 {
fmt.Println("7 is even")
} else {
fmt.Println("7 is odd")
}
if 8%4 == 0 {
fmt.Println("8 is divisible by 4")
}
// a statement can preceed conditionals
// num varibale declared is available in all branches
if num := 9; num < 0 {
fmt.Println(num, "... |
cc1347e5dcc0c05d7cdaba5ddbc451e2f87ed4bc | adb572928c3c74718e29177409dd82b5b2514c25 | maydusa/kuxingtianxia | /server/db/note.go | Go | go | 4,399 | no_license | package db
import (
"fmt"
mydb "github.com/lsj575/kxtx/server/db/mysql"
"strconv"
"time"
)
func NoteUpload(username string, title string, content string, img string, latitude string, longitude string,
location string, isOpen int) bool {
stmt, err := mydb.DBConn().Prepare(
"INSERT INTO note " +
"(`username`... |
bfecbe6ee33dff8136ece03209a35e306bfa998f | 6d700ecd032124d1f53467d0505d51d694ec74a0 | acrossnet/opa | /plugins/bundle/plugin_test.go | Go | go | 36,504 | permissive | // Copyright 2018 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package bundle
import (
"bytes"
"context"
"fmt"
"net/http"
"net/http/httptest"
"path/filepath"
"reflect"
"sort"
"strings"
"testing"
"github.com/op... |
5627902a7fe7019eafe595010d6e356ce3faa366 | a278092a4cbe119bf23a315a55453b692f5619ee | 5up3rc/prometheus | /web/web.go | Go | go | 24,510 | permissive | // Copyright 2013 The Prometheus 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... |
e6627314d48f77a4ee940b5c9a6176fc36771871 | a18e3d46ffc2913c99bb349cc6dc7a45f0f7b367 | sgtest/monorepo-test-3 | /kubernetes-8/pkg/kubelet/kubelet_cadvisor.go | Go | go | 3,318 | 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, ... |
20a4aa13f70f800012c55ab4e5dfb831eb395add | 4e9ad4f623f867225f999a57f7d41b1cdbc0c78c | lanyuechen/origin | /pkg/image/controller/controller_test.go | Go | go | 8,699 | permissive | package controller
import (
"fmt"
"testing"
"time"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util"
client "github.com/openshift/origin/pkg/client/testclient"
"github.com/openshift/origin/pkg/dockerregistry"
"github.com/openshift/origin/pkg/image/api"
)
... |
9c9dbe157ad4b602eebca439648d161b1d1d5020 | dae4d058a563fda3b18fef1a9b587ec8a1fbdd98 | sweettea-io/rest-api | /internal/app/worker/jobs/names.go | Go | go | 557 | no_license | package jobs
type names struct {
CreateTrainJob string
CreateDeploy string
BuildDeploy string
TrainDeploy string
ApiDeploy string
UpdateDeploy string
ApiUpdate string
PublicizeDeploy string
}
// Names for all supported jobs.
var Names = &names{
CreateTrainJob: "create_trai... |
64d793a0be6f5650d5c3104a1898e76c4766156e | 8351d3291b9ef06519516cd3a25201bbe15bae95 | libopenstorage/stork | /pkg/snapshot/controllers/snapshot.go | Go | go | 2,343 | permissive | package controllers
import (
"fmt"
"sync"
"time"
"github.com/kubernetes-incubator/external-storage/snapshot/pkg/client"
snapshotcontroller "github.com/kubernetes-incubator/external-storage/snapshot/pkg/controller/snapshot-controller"
snapshotvolume "github.com/kubernetes-incubator/external-storage/snapshot/pkg/... |
54f5220af8b645154068aa6e6b64b925a616338d | f753ef2de68483ce1887c6c436286fb52bd1c27b | kevinlee112/stark | /registry/etcd/etcd.go | Go | go | 8,933 | permissive | // Package etcd provides an etcd service registry
package etcd
import (
"context"
"crypto/tls"
"net"
"path"
"sort"
"strings"
"sync"
"time"
"github.com/Allenxuxu/stark/log"
"github.com/Allenxuxu/stark/registry"
json "github.com/json-iterator/go"
hash "github.com/mitchellh/hashstructure"
"go.etcd.io/etcd/c... |
532a8978c5c30407b996ffa449d926869e4c85f0 | abb2d917f4a0def6066c2ee3bbf92d9ddb4e2011 | tehcyx/goengine | /obj/obj.go | Go | go | 8,093 | permissive | package obj
import (
"bufio"
"os"
"sort"
"strconv"
"strings"
"time"
"github.com/go-gl/mathgl/mgl32"
"github.com/tehcyx/goengine/util"
)
type ObjectIndex struct {
VertexIndex int
UVIndex int
NormalIndex int
}
type IndexedModel struct {
Positions []mgl32.Vec3
TexCoords []mgl32.Vec2
Normals []mgl32... |
6483e8860afb0860ac314aad75ab987fc4250ed1 | 688e4f25e59e34366f01db42541a7fa8d7f7a970 | arthaslll/kubernetes | /pkg/util/io/io_test.go | Go | go | 1,672 | 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, ... |
14eea03ce42d3a3ade12bbf1ee21bf6ea9a4b16f | 563d9162514e2b90b7860a346d25dad19464ebb4 | lnhote/noah | /core/store/pagewriter_test.go | Go | go | 7,908 | permissive | package store
import (
"encoding/json"
"io/ioutil"
"log"
"testing"
"github.com/lnhote/noah/core"
"github.com/lnhote/noah/core/entity"
"github.com/stretchr/testify/assert"
)
func TestGetFrameType(t *testing.T) {
assert.Equal(t, FullType, getFrameType(1024, 1016, 0))
assert.Equal(t, FirstType, getFrameType(10... |
77db1b6df24dd2baff01c0f7d32d1938529ca139 | c06673c805f959851fceb44d0e4859da43cd90ac | ifishnet/winsvc | /registry/registry.go | Go | go | 1,678 | permissive | // Copyright 2012 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.
// +build windows
// Package registry provides access to Windows registry.
//
package registry
import (
"syscall"
"unsafe"
"github.com/ifishnet/winsvc/win... |
5f6b1d303d767654987b9fc09ecbc7063c97ec64 | 8bf4c48f8cf76231f2daa836febbeb6477330b2e | spikecurtis/felix | /fv/pre_dnat_test.go | Go | go | 7,373 | permissive | // +build fvtests
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unles... |
3492f30feb5600f6274447c569a078e8fd987587 | 2fc3d24266080c3eb223b82d0153eb3b1b560267 | ricardomaricato/learning-go | /Cap.05_exercicios-ninja-2/04_exercicio/main.go | Go | go | 603 | no_license | package main
import "fmt"
/*
- Crie um programa que:
- Atribua um valor int a uma variável
- Demonstre este valor em decimal, binário e hexadecimal
- Desloque os bits dessa variável 1 para a esquerda, e atribua o resultado a outra variável
- Demonstre esta outra variável em decimal, binário e hexadecimal
*/
func mai... |
43b42b33575d3296a5d96acea24b47740a7f274d | c122b3b30e2efa9ee7f36665688745afa2d4b79f | horizonzy/kubernetes | /pkg/registry/apps/statefulset/strategy.go | Go | go | 7,584 | 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, ... |
be614da979441ef158429d185f16fb6a9d4a2b3c | 5b9d801f67763e966c4f356d1ce833d4aa7c989c | hniihara723/aws-sns-subscriber | /subscribe.go | Go | go | 1,368 | no_license | package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sns"
"os"
)
const httpEndpoint = "https://6303c682.ngrok.io"
const httpProtocol = "https"
const snsTopicARN = "arn:aws:sns:ap-south-1:725344396561:open-faas-test"
const awsRegion... |
75fac08ecfc631623e5a8bdecf751b538c51b436 | e5bb2dd24dfb699876b13e2229584fecf93e6ddc | bingosummer/open-service-broker-azure | /pkg/services/mssql/all_in_one_bind.go | Go | go | 1,777 | permissive | package mssql
import (
"fmt"
"github.com/Azure/open-service-broker-azure/pkg/service"
)
func (a *allInOneManager) ValidateBindingParameters(
service.BindingParameters,
service.SecureBindingParameters,
) error {
// There are no parameters for binding to MSSQL, so there is nothing
// to validate
return nil
}
fu... |
0b7ba271c3ecb2986a35bf9d09946fea0a0353e5 | 7acfdfc393864af1f7d0be1723c0ecf03ee167cf | dbulant/project-euler | /Problem9/problem9_test.go | Go | go | 428 | no_license | // problem9_test
package projecteuler
import "testing"
func TestIsPairPythagorean(t *testing.T) {
r := isPairPythagorean(3, 4)
if !r {
t.Errorf("expected result is %t, got instead %t \n", true, r)
t.Errorf("3^2 + 4^2 = 9 + 16 = 25 = 5^2 \n")
}
}
func TestGeneralProblem9(t *testing.T) {
arr := GeneralProblem9... |
461949522245698a3ea2bc2f2764678869cca815 | 0f7a1b73fe712f345e4d177a62be14cb710623e0 | iamemilio/machine-api-provider-openstack | /pkg/machine/machineScript.go | Go | go | 5,162 | 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 writing, ... |
f3a262f4577505543eb232404fbeff4ad62ae42c | 8d970b027d5e4a61945213ccab83584e9ef2a82a | jimmy2012/mahjong-helper | /core.go | Go | go | 24,949 | permissive | package main
import (
"fmt"
"github.com/fatih/color"
"github.com/EndlessCheng/mahjong-helper/util"
"github.com/EndlessCheng/mahjong-helper/util/model"
)
type DataParser interface {
// 数据来源(是天凤还是雀魂)
GetDataSourceType() int
// 获取自家初始座位:0-第一局的东家 1-第一局的南家 2-第一局的西家 3-第一局的北家
// 仅处理雀魂数据,天凤返回 -1
GetSelfSeat() int
... |
cef7da78751b4b79f269ba75443fbac1f0e0c4b4 | c716c8813b0128771eb32e3ddbad0247f20e0d5d | errordeveloper/goformation | /cloudformation/aws-iam-group.go | Go | go | 4,271 | permissive | package cloudformation
import (
"encoding/json"
"errors"
"fmt"
)
// AWSIAMGroup AWS CloudFormation Resource (AWS::IAM::Group)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html
type AWSIAMGroup struct {
// GroupName AWS CloudFormation Property
// Required: false
... |
c8e0fe300b179882645379f76c371652fcd3efc3 | 7c5c001edeb23b7ec57ef2be876be99112ddaed0 | udistrital/ubicaciones_crud | /routers/commentsRouter____ubicaciones_crud_controllers.go | Go | go | 13,735 | no_license | package routers
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/context/param"
)
func init() {
beego.GlobalControllerRouter["github.com/udistrital/ubicaciones_crud/controllers:AtributoLugarController"] = append(beego.GlobalControllerRouter["github.com/udistrital/ubicaciones_crud/controllers:Atributo... |
2b2ddd4d42c430ffaf3e5928aa6a4651c82df022 | 2f246221ef08e11345d4f0bbf728cc3f6208de60 | cloudfoundry/buildpackapplifecycle | /launcher/profile/profile_windows.go | Go | go | 1,361 | permissive | //go:build windows
// +build windows
package profile
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
)
func ProfileEnv(appDir, tempDir, getenvPath string, stdout io.Writer, stderr io.Writer) ([]string, error) {
fi, err := os.Stat(tempDir)
if err != nil {
... |
9a068358647adbce004d99e049c453b8c3c43791 | b5d9f475627152279cf9ec2748d48324a5352082 | amanenk/faker | /price_test.go | Go | go | 1,195 | permissive | package faker
import (
"reflect"
"strings"
"testing"
"github.com/cloudquery/faker/v3/support/slice"
)
func TestSetPrice(t *testing.T) {
SetPrice(Price{})
}
func TestCurrency(t *testing.T) {
p, err := GetPrice().Currency(reflect.Value{})
if err != nil {
t.Error("Expected not error, got err", err)
}
if !s... |
10f82236ecccc22d2dc15eb285c5ba1f7bc63482 | dacf9916a05112138aa9ef8e12d09238681cfff1 | walk1ng/scratch-go | /programming-k8s/kubebuilder/watching-externally-managed-resource/util/util.go | Go | go | 339 | permissive | package util
func SliceContainsString(slice []string, s string) bool {
for _, item := range slice {
if item == s {
return true
}
}
return false
}
func RemoveStringFromSlice(slice []string, s string) (result []string) {
for _, item := range slice {
if item == s {
continue
}
result = append(result, ... |
e57e64b31205f29ec058dcab2a803f01a82176fb | 1256f4af76d9ab3150abc12abdfd1132fe964daf | sgtest/monorepo-test-3 | /kubernetes-11/plugin/pkg/scheduler/algorithm/priorities/test_util.go | Go | go | 2,198 | 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, ... |
55bb2843d06e4d4f0a3d77a901e8ea3f45eca548 | 2437a8acd440ee5a707cccfe764e050835303024 | kokopiotrowski/SEP6-Backend | /swagger/api_person.go | Go | go | 2,515 | no_license | /*
* SEP6-movies backend
*
* Backend part of the project delivered for SEP6 course - Movies platform Authors of project: Konrad Piotrowski (280053) Aleksander Stefan Bialik (280027)
*
* API version: 1.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package swagger
imp... |
9f62bbf75c68ed568800390e6311b5befece9a25 | 997dd262af8e0fe60101444a9e0e5b9a2d9f54df | yabberyabber/ddd | /mvcc.go | Go | go | 1,478 | no_license | package main
import (
"sync"
"sync/atomic"
)
// VersionRange represents the range of transaction versions for which this
// record exists. Min must be a nonzero positive integer. Max must be a
// non-negative integer. If max is 0, then this record still exists in the
// latest version.
type VersionRange struct {
m... |
5c2dee6b6f0f63103496348b065c3961505bef73 | f35304504f0ca28cf2abf20db8e40fd9b8ec5004 | kenfdev/faas-rancher | /handlers/deploy.go | Go | go | 2,469 | permissive | // Copyright (c) Alex Ellis 2017, Ken Fukuyama 2017. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package handlers
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"regexp"
"github.com/alexellis/faas/gateway/requests"
"g... |
89440e07db7530a8e05e1574cd1ff41218a80658 | 7cb99dd092045ce9e039b50bb8de903fb589076c | bryansray/AdventOfCode-2018 | /day-6/chronal-coordinates.go | Go | go | 2,287 | no_license | package main
import (
"bufio"
"fmt"
"log"
"os"
)
type coordinates struct {
X, Y int
}
func main() {
input := read()
letter, answer1 := part1(input)
fmt.Printf("Answer for part 1: %d (coordinates %c)\n", answer1, letter)
fmt.Printf("Answer for part 2: %d\n", part2(input, 10000))
}
func part1(input []coordin... |
96635a67b3360f5c0a89ae7e961247dd895b3f77 | 7a6e3cb65116c07f77f7aed69d2d6919e6f352a0 | PsymonLi/sw | /nic/delphi/gosdk/messenger/receiver.go | Go | go | 1,259 | no_license | package messenger
import (
"bufio"
"errors"
"fmt"
"io"
"log"
"net"
"github.com/golang/protobuf/proto"
"github.com/pensando/sw/nic/delphi/messenger/proto"
)
type transportHander interface {
HandleMessage(message *delphi_messenger.Message) error
SocketClosed()
}
type receiver struct {
connection net.Conn
... |
375e7de720e0cc78099a3f04eaa92215fbae90db | cf04fb670b20a697a7fd2e283594904611d273b0 | kube-ci/engine | /pkg/credentials/gitcreds/ssh.go | Go | go | 3,931 | permissive | /*
Copyright 2018 The Knative 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, soft... |
73186297354e23c29f301260a77214371cd1b463 | 91a6dfd6f66832755f24bc69de8f7fc0f56aa4dd | lucasmarqs/terraform-provider-keycloak | /keycloak/keycloak_client.go | Go | go | 9,184 | permissive | package keycloak
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
"time"
)
type KeycloakClient struct {
baseUrl string
realm string
clientCredentials *ClientCredentials
httpClient *http.Client
}
type ClientCredentia... |
8ba24f9cb2d3e0b2ab82b674da2cff4fdad9b797 | c8867381515cf2cd496d46b5791259335f1a6f00 | sondhayni-rfqa/rainforest-cli | /rainforest/rainforest.go | Go | go | 4,583 | permissive | // Package rainforest is a golang client for the Rainforest QA API
package rainforest
import (
"bytes"
"encoding/json"
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
)
const (
// Version of the lib in SemVer
libVersion = "2.0.0"
currentBaseURL = "https://app.rainforestqa.com/api/1/"
authToke... |
0e7b2cfebfc9a69e94bcdbfad610d73277c44b41 | 41ad6edbfe3285f04a84e8f7671a0199b868497d | WWGLondon/graduation | /vendor/gobot.io/x/gobot/examples/bebop_ps3_video.go | Go | go | 4,349 | permissive | /*
This example will connect to the Parrot Bebop allowing you to control
it using a PS3 controller.
It also streams the drone video to a webpage via ffserver.
This requires you to have both ffmpeg and ffserver installed
on your computer.
In order to run this example you will first need to start ffserver with:
... |
6dc99e5b069d667e9bb961844a9ea6b3e218e377 | d6c2d6ca6b3d05e42b482fd1590f8c0ae155de4c | Vito89/arithmeticutil | /compare_test.go | Go | go | 334 | no_license | package arithmeticutil
import "testing"
func TestMin(t *testing.T) {
cases := []struct {
inA, inB, want int
}{
{0, 127, 0},
{-1, 0, -1},
{255, 0, 0},
}
for _, c := range cases {
got := Min(c.inA, c.inB)
if got != c.want {
t.Errorf("Error with: %v, %v. Wanted: %v but got: %v", c.inA, c.inB, c.want, ... |
e91f5f90b03630ff5bec2957169607d035b0ae84 | 2a612da6f07af0b8c2cacaa574b5d4bc319bd567 | anselmolsm/abireport | /src/abireport/cmd/version.go | Go | go | 1,306 | permissive | //
// Copyright © 2016-2017 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 law... |
5f669bc905d1ae8767e49d647b328cb1b64da48f | 7d2bfd0963772057908d794fed79c1f6e2f2df66 | teaualune/gatt | /linux/cmd/cmd.go | Go | go | 38,593 | permissive | package cmd
import (
"bytes"
"errors"
"fmt"
"io"
"log"
"github.com/teaualune/gatt/linux/evt"
"github.com/teaualune/gatt/linux/util"
)
type CmdParam interface {
Marshal([]byte)
Opcode() int
Len() int
}
func NewCmd(d io.Writer) *Cmd {
c := &Cmd{
dev: d,
sent: []*cmdPkt{},
compc: make(chan ev... |
ad3dc273ccfd9292ca32b1df7bc5bdb546ec0f15 | b2dc0123332f847af09e44031bf873f8d16a2f4b | gitter-badger/mmo | /client/world.go | Go | go | 1,570 | no_license | package main
import (
"log"
"math"
"time"
"golang.org/x/image/colornames"
"github.com/faiface/pixel"
"github.com/faiface/pixel/imdraw"
)
func LoadWorld() *pixel.Batch {
t1 := time.Now()
grass, err := loadPicture("sprites/grass.png")
if err != nil {
log.Fatal(err)
}
ground := pixel.NewSprite(grass, gras... |
cbd866e99e40f723f2480db5be3f60a820dc166d | f9e8220b4bb07a469062cb532f69c1e0e8aa25b9 | engr-hasanuzzaman/learn-go | /go-module/main.go | Go | go | 2,198 | no_license | package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"github.com/labstack/gommon/log"
"html/template"
"io"
"github.com/engr-hasanuzzaman/test/handler"
)
func index(c echo.Context) error {
// return c.String(http.StatusOK, "wellcome to echo world")
return c.Render(... |
e8146d28b81c1132888c78fc06a89dd86324e86b | 00b641620c06fbebdd4afc9fb8ec6a7276d71c93 | someoneapp/fabric-gm | /vendor/github.com/someoneapp/grpc/go16.go | Go | go | 3,703 | permissive | // +build go1.6,!go1.7
/*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notic... |
fde2c42b0c05d2e338af78e2ec8581205d8fac24 | b31322266d887c55997bb916e3e64c605bd30dd4 | mylearning2017/goruby | /evaluator/evaluator_test.go | Go | go | 15,637 | no_license | package evaluator
import (
"reflect"
"testing"
"github.com/goruby/goruby/lexer"
"github.com/goruby/goruby/object"
"github.com/goruby/goruby/parser"
)
func TestEvalIntegerExpression(t *testing.T) {
tests := []struct {
input string
expected int64
}{
{"5", 5},
{"10", 10},
{"-5", -5},
{"-10", -10},... |
3fc8b2f479cf9078bdd1eaaab93bf30b49eea41b | 8bd98c83ad1bf7486dd379016cf0b85ea2c618b0 | theeath/filestore-server | /service/transfer/main.go | Go | go | 1,075 | no_license | package main
import (
"bufio"
"encoding/json"
"filestore-server/config"
"filestore-server/db"
"filestore-server/mq"
"filestore-server/store/oss"
"log"
"os"
)
//处理文件转移的真正逻辑
func ProcessTransfer(msg []byte)bool {
log.Println(string(msg))
//解析msg
pubData := mq.TransferData{}
err := json.Unmarshal(msg,&pubDat... |
b96162a7ada92364438b0ea99c047d4409bd28ff | d8233aeaba87ede96c2de19cd5461e3e77fd2002 | leezhu/try-golang | /newCache2go/cacheitem.go | Go | go | 3,552 | permissive | // 一个简单具有过期功能的缓存item
package cache2go
import (
"sync"
"time"
)
//CacheItem 是一个独立的缓存item,是包含元数据的最小单位
//可以理解成存的实际k-v数据实体
type CacheItem struct {
sync.RWMutex //加锁
key interface{} //key
data interface{} //数据value
lifeSpan time.Duration //生命周期,如果没有访问,则会被移除
createdOn time.Time //创建的时间戳
accessdOn... |
75344c47b9008b021a99ab129b0aacefc365896c | c4683cfe0f7a3d025b3b4326025f0de160e33e82 | claimly/autobot | /app/synccmd.go | Go | go | 2,173 | permissive | package app
import (
"fmt"
"log"
"github.com/mkock/autobot/config"
"github.com/mkock/autobot/dataprovider"
"github.com/mkock/autobot/dmr"
)
// init registers the command with the parser.
func init() {
var syncCmd SyncCommand
parser.AddCommand("sync", "synchronise", "synchronise the vehicle store with an exter... |
e7eec8f97c2f3fa7596a915ba9e85d51084e34cd | 70802137cd2982a1d3082e34a49eabd9af871ff8 | kubernetes/test-infra | /prow/github/report/report_test.go | Go | go | 20,069 | 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, ... |
9c2e07d2e6bcba2477dd78d95e4664047a94892c | f8481fe91a0e4a501352e820b35685784b86e4b1 | IntouchOpec/base-go-echo | /model/omise.go | Go | go | 470 | no_license | package model
import (
"database/sql"
"encoding/json"
)
type OmiseLog struct {
Json json.RawMessage `sql:"type:json" json:"object,omitempty"`
AccountID uint `json:"account_id"`
Account Account `json:"account" gorm:"ForeignKey:AccountID"`
}
func (o *OmiseLog) Create(sql *sql.DB) error {... |
be83cfde1a5ab457428e00f1151453f1f72c91a6 | 0185e540d079ed35c451d2ef47d3f381f3c58d49 | abourget/gopy | /bind/symtab.go | Go | go | 24,357 | permissive | // Copyright 2015 The go-python 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 bind
import (
"fmt"
"go/types"
"hash/fnv"
"reflect"
"sort"
"strings"
)
var (
universe *symtab
)
func hash(s string) string {
h := fnv... |
daa8390e905b0456de0cd5a04ce330383c5d1f19 | 224abf7dc0dadd67048c82fd4a59782a52f4bf8b | bskbala/Golang | /Assingments/practice01/a1-Basic-Programs1/a-Basic-Programs/a-largest-num-practice.go | Go | go | 549 | no_license | package main
import ( "fmt"
)
func main (){
fmt.Println("Enter first Number")
var first int
fmt.Scanln(&first)
fmt.Println("Enter second Number:")
var second int
fmt.Scanf("%d" ,&second)
fmt.Println("Enter third Number:")
var third int
fmt.Scanf("%d" ,&third)
if (first >=second && first >=third){
fmt.... |
c342ecb3ad31136637427b01eeec3abfba001312 | bc668f067d6e1245b05ad7ad9b8bc1b449e8de96 | richardstu/commonchat-go | /emoji_to_url_test.go | Go | go | 1,004 | permissive | package commonchat
import (
"fmt"
"testing"
)
var EmojiTests = []struct {
v string
v2 string
want string
}{
{"https://grokify.github.io/emoji/assets/images/%s.png",
":ghost:", "https://grokify.github.io/emoji/assets/images/ghost.png"}}
func TestEmojiURL(t *testing.T) {
for _, tt := range EmojiTests {
... |
c174550c131463c489cb0a3e466d08f7ccfcc873 | 7a3f96a70393370e7c3051466f1de9449af922bf | hunghhdev/guide | /golang/api-send-mail/src/app/application.go | Go | go | 318 | no_license | package app
import (
"api-send-mail/src/controllers/gmail"
"api-send-mail/src/schedule"
"github.com/gin-gonic/gin"
)
var (
router = gin.Default()
)
// StartApplication run app
func StartApplication() {
go schedule.SendMail()
router.GET("/forgot-password/:email", gmail.ForgotPassword)
router.Run(":3000")
}
|
0752a45c98e8ba47134240fb4981c093ba0fcad6 | 07483739ef265f2648aee98a0fa0eff89c22188f | sohaha/zzz | /app/root/config.go | Go | go | 3,303 | permissive | package root
import (
"fmt"
"time"
"github.com/sohaha/zlsgo/zutil"
)
var ExampleConfig = `# zzz 主配置
# 核心配置
core:
# 配置版本号,勿手动修改
version: %v
# 版本检测时间,勿手动修改
detection_time: %v
# 其他配置
other:
# 显示毒鸡汤
du: true
`
var ExampleStressConfig = `# zzz stress%v 配置
# 请求次数
Count: 10
Concurrency: 5
Quie... |
2de42105215d9845c5ce23a8ff8d8ac97aa36ea2 | 312fd33e7970a72821c170bccea6486b34ea8234 | VixikHD/sun | /sun/translations.go | Go | go | 8,307 | permissive | /**
___ ___ ___
/ /\ /__/\ /__/\
/ /:/_ \ \:\ \ \:\
/ /:/ /\ \ \:\ \ \:\
/ /:/ /::\ ___ \ \:\ _____\__\:\
/__/:/ /:/\:\ /__/\ \__\:\ /__/::::::::\
\ \:\/:/~/:/ \ \:\ / /:/ \ \:\~~\~~\/
\ \::/ /:/ \ \:\ /:/ ... |
6b50f96677d74e222874cd1955eac81a7c19d6b0 | f723c8e01d161040d627dec7ed64eccdc7f2b2fc | vmware/vsphere-automation-sdk-go | /services/nsxt/infra/Ipv6NdraProfilesTypes.go | Go | go | 14,679 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Data type definitions file for service: Ipv6NdraProfiles.
// Includes binding types of a structures and enumerations defined in the service.
// Shared by client-side stubs and se... |
4403726f288f04228ce829e0313381785856d737 | ef90c2ee834bd4cf2fbde1239609a28a8229a49b | trentsummerfield/tvm | /cmd/visual-tvm/main.go | Go | go | 5,070 | permissive | package main
import (
"fmt"
"os"
"strings"
termbox "github.com/nsf/termbox-go"
"github.com/trentsummerfield/tvm"
)
func drawString(x, y int, s string, color ...termbox.Attribute) {
fg := termbox.ColorDefault
bg := termbox.ColorDefault
l := len(color)
if l > 0 {
fg = color[0]
}
if l > 1 {
bg = color[1]... |
e93b33ff84636e85a1f4715b827be0c0c2321d9c | 54b9694fa8ece28a7207388345f11db42a039df3 | bfayenke/flux2 | /cmd/flux/bootstrap_github.go | Go | go | 10,127 | permissive | /*
Copyright 2020 The Flux 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, softwar... |
c9c5217881423661c66ef22301a12a26312e6849 | 05ec7760f1f95f0bedcdbc3ee1bc102d3acb8884 | juzi5201314/MineGopher | /network/raknet/protocol/packets/ACK.go | Go | go | 256 | no_license | package packets
import (
"github.com/juzi5201314/MineGopher/network/raknet/protocol"
)
type ACK struct {
*AcknowledgementPacket
}
func NewACK() *ACK {
return &ACK{
&AcknowledgementPacket{
protocol.NewPacket(FLAG_DATAGRAM_ACK),
[]uint32{}}}
}
|
f496f4bef2d73de6310c365a6ebaeb039a812c6f | b890530970041efa6d1d8ed718a338c1a964a315 | c4nc/openbazaar3.0 | /repo/repo.go | Go | go | 11,744 | no_license | package repo
import (
"context"
"crypto/ed25519"
"crypto/rand"
"encoding/json"
"errors"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/cpacia/openbazaar3.0/database"
"github.com/cpacia/openbazaar3.0/database/ffsqlite"
"github.... |
53fc8c1d914f381076181c411a7389fd2343da84 | 928688448ae750dcdf1092d21d2c2bbe38afb0c6 | tomgeudens/gopl | /server3/main.go | Go | go | 773 | no_license | /*
description :
server3 is a minimal echo server that echoes request information
author :
Tom Geudens (https://github.com/tomgeudens/)
modified :
2017/07/24
*/
package main
import "fmt"
import "log"
import "net/http"
func echoHandler(rw http.ResponseWriter, req *http.Request) {
fmt.Fprintf(rw, "%s %s %s\n",... |
0ba4abc55c64dbe9457d8dd146441794a8be3dc8 | fd71470e62860d086b15a88083f5d4dfe7540a22 | dbenoit17/cluster-api-provider-aws | /pkg/actuators/machine/utils.go | Go | go | 9,786 | 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 writing, ... |
46c3d4374007a34b3c14c9951ca293de0101e28d | c07b99af2bccb7dc92d74f45abf93518425596c4 | seriousben/grafton | /acceptance/dsl.go | Go | go | 2,667 | permissive | package acceptance
import "context"
var (
failures int
success int
features []*FeatureImpl
)
// FeatureFunc is the func type run to test features
type FeatureFunc func(ctx context.Context)
// FeatureImpl is a feature implementation.
type FeatureImpl struct {
label string
name string
fn FeatureFunc
hasRun... |
425061fcda5f5f4bc0b1f80f209ebb263b2d9ac8 | b73bf64c16e72c64221437f0edf45ee017eb3c4e | kevwan/evio | /internal/internal_linux.go | Go | go | 2,978 | permissive | // Copyright 2017 Joshua J Baker. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package internal
import "syscall"
const (
EventClose uint64 = 1
EventTick uint64 = 2
EventWrite uint64 = 3
)
type (
EventHandler interface {
OnEvent(... |
f1fef46ded875460a61a7ebc4b6d48ea2d323e0f | 680500b47d3d7f297b6cfbb909f02a61b961a151 | AiPart/leetcode | /18.验证二叉搜索树/go/98.go | Go | go | 475 | no_license | import "math"
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
func isValidBST(root *TreeNode) bool {
return valid(root, math.MinInt64, math.MaxInt64)
}
func valid(root *TreeNode, lower, upper int) bool {
if root == nil {
retu... |
d669e240be268e2158fbcf150557c2bac4312d66 | 6bbcf6b98da3bc6e4609584b58c40a2342971ae7 | mj073/golangLearning | /golangTraining/deferAndErrorHandling/errorHandling/error2.go | Go | go | 410 | no_license | package main
import (
"fmt"
"log"
"os"
)
func main() {
f,err := os.OpenFile("/home/mahesh/golang/src/github.com/golangLearning/deferAndErrorHandling/defer/defer2.go",os.O_RDONLY,0644)
if err != nil {
log.Fatalln("failed to open file...ERROR:",err)
}
defer f.Close()
data := make([]byte,450)
_, err = f.Read(... |
6db1f5f4dc3f57604f6225687a7386240d15947d | 7003a5e8d1d37d5a5bd408102ca119cf220189af | froghui/origin | /pkg/template/registry/rest_test.go | Go | go | 1,229 | permissive | package template
import (
"testing"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
config "github.com/openshift/origin/pkg/config/api"
template "github.com/openshift/origin/pkg/template/api"
)
func TestNewRESTInvalidType(t *testing.T) {
storage := NewREST()
_, err := storage.Create(nil, &kapi.Pod{})... |
558f6c934e299ec2785e408bc5311c1051e4a0e7 | bba476912a49742476b06e0a92c09d343388eee5 | overvenus/ticdc | /pkg/config/cyclic.go | Go | go | 1,566 | permissive | // Copyright 2020 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... |
bea1860992280cd82e373623108c2ab16ef1dc6d | 935331451a95e1bfee686caba61116616d4d4aaf | tminor/trickster | /vendor/go.opentelemetry.io/otel/exporters/trace/zipkin/zipkin.go | Go | go | 5,695 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
b07c35cadc95b4a56b7014140aaac42ce988758b | 7b9ab8d7f8209b0a7dd21859d8a1914c2ab848d7 | artursouza/kit | /logger/options_test.go | Go | go | 2,034 | permissive | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation and Dapr Contributors.
// Licensed under the MIT License.
// ------------------------------------------------------------
package logger
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOptions... |
681dfb150d8d3e05eea1b39ae891f626fa086919 | e1e77bdb4aac5bbde1a105455dc3ca1b11474653 | nabbar/golib | /artifact/client/interface.go | Go | go | 1,675 | permissive | /*
* MIT License
*
* Copyright (c) 2020 Nicolas JUHEL
*
* 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, co... |
7226f807e5f90351706f6a2715bf2a8fbc4d2184 | 51e6bc6882dc5fc20ba01778f4fb46dd9ba7aff7 | daniel-vera-g/go-grpc-server | /client/main.go | Go | go | 796 | permissive | package main
import (
"fmt"
"log"
"github.com/daniel-vera-g/golang-grpc-server/api/birthday"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
func main() {
var conn *grpc.ClientConn
// Initiate a connection with the server
conn, err := grpc.Dial("192.168.0.94:7777", grpc.WithInsecure())
if err != nil ... |
23ec09aa5a2d57ce27a1d25c31499ae261f07a80 | bf497215902952de42fa34254b61d582f28df541 | kakazu-takaki-gn/kkzMonkey | /token/token.go | Go | go | 883 | no_license | package token
type TokenType string
type Token struct {
Type TokenType
Literal string
}
const (
ILLEGAL = "ILLEGAL"
EOF = "EOF"
IDENT = "IDENT"
INT = "INT"
ASSIGN = "="
PLUS = "+"
MINUS = "-"
BANG = "!"
ASTERISK = "*"
SLASH = "/"
LT = "<"
GT = ">... |
50283b265750b3aff83f5cb4d4615bf455c0950a | 65f802f8cca77ea92cb7264119d8be4b0838aa9b | sko00o/leetcode-adventure | /binary-search/conclusion/vsqrt.go | Go | go | 369 | no_license | package conclusion
func isPerfectSquare(num int) bool {
// positive integer num
if num <= 1 {
return true
}
low, high := 1, num
for low <= high {
mid := low + (high-low)>>1
mul := mid * mid
if mul == num {
return true
} else if mul > num || mul <= 0 { // mul <= 0 means overflow
high = mid - 1
}... |
d0e850f0e9746093296aeb74002b7e3e30e124b3 | 8dd36f4eb65f336026677dbe3c4fd37f92b57d60 | hoozecn/erda | /modules/cmp/component-protocol/components/cmp-dashboard-nodeDetail/header/model.go | Go | go | 938 | permissive | // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
c1276752290a110319c662feca2c58ff6613ff52 | 4f7b53955d8fa7b60ff368f190f8581b0f07570e | BigMouseZ/go-integration | /golangdemo/time/timetest/timetest.go | Go | go | 1,782 | no_license | package timetest
import (
"fmt"
"time"
)
func TestOne() {
timeTemplate1 := "2006-01-02 15:04:05" // 常规类型
timeTemplate2 := "20060102150405" // 常规类型
fmt.Println(time.Now().Format(timeTemplate1))
fmt.Println(time.Now().Format(timeTemplate2))
// 获取毫秒
fmt.Println(time.Microsecond)
// 获取月
fmt.Println(time.M... |
cc44afa05b6797eb816f653a60b3e191ba9c4990 | be119e9bfcc9dbefd8bd78e4f2d510f5f2ae32bb | viruswevh/go-qlc | /config/verifier.go | Go | go | 1,055 | permissive | /*
* Copyright (c) 2019 QLC Chain Team
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
package config
import (
"errors"
"fmt"
"reflect"
"strings"
"github.com/qlcchain/go-qlc/common/types"
"gopkg.in/validator.v2"
)
// qlc address validator
func address(v inter... |
8b2ee5257b3a39afe0510e90a055ed7cb5529bbb | 53f63e19f89ad1edee36f30b7a9e6eb4d8dc4b2f | joeybolleman/autodns | /autodns/cmd/version.go | Go | go | 1,148 | permissive | package cmd
import (
"fmt"
"runtime"
"github.com/lolPants/autodns/autodns/pkg/constants"
"github.com/spf13/cobra"
)
var (
sha1ver = constants.VersionUnknown
gitTag string
buildTime string
)
type versionRow struct {
label string
value string
}
var (
versionCmd = &cobra.Command{
Use: "version",
... |
ad03b4760031babb17d862b0d3e4926504ae6e35 | 281a77674e9bd97a6f965533e3a455ad7f46878c | masskoder/whisper | /pkg/config/config_test.go | Go | go | 4,627 | permissive | package config_test
import (
"os"
"testing"
"github.com/gin-gonic/gin"
"github.com/rotationalio/whisper/pkg/config"
"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
)
var testEnv = map[string]string{
"WHISPER_MAINTENANCE": "false",
"WHISPER_MODE": "release",
"WHISPE... |
478dd13f9e6113076defcc3cdcf71e408b4415df | 9fcf274facd3e72487d2d643b1e606c5e5e4963f | microsoftgraph/msgraph-beta-sdk-go | /models/kerberos_sign_on_settings.go | Go | go | 8,812 | permissive | package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e "github.com/microsoft/kiota-abstractions-go/store"
)
// KerberosSignOnSettings
type KerberosSi... |
45e78d7a969104a7a4d14b54f21ccfe7150231b0 | 49bb72c70e56ecba083dcca4b750c9e4a5ad1bab | EnggarSe/learn-go-task1-package | /main.go | Go | go | 1,211 | no_license | package main
import (
"fmt"
"github.com/EnggarSe/task1-interface/motor"
"github.com/EnggarSe/task1-interface/sepeda"
"github.com/EnggarSe/task1-interface/speed"
)
func main() {
var jarak float32
var k speed.Maju
fmt.Print("Masukan Jarak Tempuh : ")
fmt.Scanln(&jarak)
fmt.Println("-----------Sepeda----------... |
b4974ae43d4a902556c26828e0ad9f9a2fc90cb4 | d00382aa671f07ae4713d5c605ee1247a6fe513e | blakerouse/elastic-agent-v2-poc | /elastic-agent/agent/manager.go | Go | go | 1,972 | no_license | package agent
import (
"context"
"errors"
"github.com/blakerouse/elastic-agent-sdk/pkg/proto"
"github.com/elastic/elastic-agent/pipeline"
"github.com/elastic/elastic-agent/server"
)
var esCfg = `
hosts:
- localhost:9200
username: elastic
password: changeme
`
type Manager struct {
components []*pipeline.Compon... |
238a2efc39d7559005c42420ca4bd3e10a7c363b | ceb342db498bfec4fdf4af3e719f0d3987883479 | AremanHashemi/doola | /internal/user/controller_test.go | Go | go | 239 | no_license | package user
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestController_CreateUser(t *testing.T) {
r := FakeRepo{}
c := Controller{
repo: r,
}
u := c.CreateUser("Areman")
assert.Equal(t, "Areman", u.Name)
}
|
359ce2898b2f3714afb0c94d63055a56969a4289 | 4a7a76c048892ab3d0ab0df407e3f9972190b8ef | shimakaze-git/Go-practice | /practice/for.go | Go | go | 213 | no_license | package main
import "fmt"
func main() {
var num int
var pow int
var result = 1
num = 2
pow = 4
for i := 0; i < pow; i++ {
result *= num
}
fmt.Printf("%dの%d乗は%dです。\n", num, pow, result)
}
|
ae07f3c2713c70041883b3689d648409746dc2a8 | ebd96a3d50578d3172cef9ce38432fa5807ebd85 | briananderson1222/spin | /command/pipelines/pipeline_delete.go | Go | go | 2,938 | permissive | // Copyright (c) 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 ... |
b048ea51178a10aa2fe6a280748f8ea26c2b77e9 | d6ad5cda6645fe988bf7975d40903ee711eda9b4 | amscanne/gvisor | /test/packetimpact/tests/tcp_rcv_buf_space_test.go | Go | go | 2,882 | permissive | // Copyright 2020 The gVisor 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 agree... |
9b95a37f7364c2823ac448373e7a4d27a2943c29 | 8104edb721ebc5d4950b1460f537442951e819d1 | AzyCrw4282/cheesse | /api/api_examples_test.go | Go | go | 2,116 | permissive | package api
import (
"fmt"
"strings"
)
func ExampleAPI_DefaultGame() {
var (
a = New()
game = a.DefaultGame()
)
fmt.Println(game.Board.Board[0])
fmt.Println(game.Board.Board[1])
fmt.Println(game.Board.Board[6])
fmt.Println(game.Board.Board[7])
//fmt.Print("asdfdasf")
// Output:
// ♜♞♝♛♚♝♞♜
// ♟♟♟♟♟... |
0ab519932c1552ffe0bd1ae0231d1d3945f70a72 | 4821735e59998d15d02a64244def60bfeb83e880 | Shaked/go-url-fuzzer | /flow/components/result/printer/printer.go | Go | go | 521 | permissive | package printer
import (
"log"
"github.com/mtojek/go-url-fuzzer/flow/messages"
"github.com/trustmaster/goflow"
)
// Printer receives found relative URLs and prints them to default logging output.
type Printer struct {
flow.Component
FoundEntry <-chan messages.FoundEntry
}
// NewPrinter creates new instance of... |
5b84d21011b6c573f6ffe6de52b46afce807a9b6 | 9891665ab74a184894d306a750cd1c07002d6ce3 | tianhucn/gf | /.example/os/gview/bind_func/gview_func1.go | Go | go | 469 | permissive | package main
import (
"fmt"
"github.com/dxasu/gf/frame/g"
"github.com/dxasu/gf/os/gview"
)
// 用于测试的内置函数
func funcTest() string {
return "test content"
}
func main() {
// 解析模板的时候传递模板函数映射Map,仅会在当前模板解析生效
parsed, err := g.View().ParseContent(`call build-in function test: {{test}}`, nil, gview.FuncMap{
"test": f... |
56280fa39c0276921787caa917a59a3b82ce1af7 | 24b3e6538b01ca14b9a23344437fc2dc126e9bd1 | bozu00/lightning_study_app | /src/handler/article.go | Go | go | 1,402 | no_license | package handler
import (
"github.com/labstack/echo"
"net/http"
"strconv"
// "log"
"virtualhost.local/kirakira/lightning_study_app/src/viewModel"
"virtualhost.local/kirakira/lightning_study_app/src/customError"
"github.com/Shaked/gomobiledetect"
)
func Article(c echo.Context) error {
detect := mobil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.