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 |
|---|---|---|---|---|---|---|---|---|
b3cb08eb3241ef689290518baed8105b114bb2a0 | 696d82568bb281ae054a3e692e795962181814b4 | ppwfx/go-record | /pkg/rendered/store_byte_slice.go | Go | go | 436 | no_license | package store
import (
"github.com/21stio/go-record/pkg/types"
"github.com/21stio/go-record/pkg/e"
)
type StoreByteSlice interface {
StoreByteSlice(types.Ctx, []byte) (types.Ctx, error)
}
type GetByteSlice interface {
GetByteSlice(types.Ctx) ([]byte)
}
type LoadByteSlice interface {
LoadByteSlice(types.Ctx) ... |
78ec73beb0c36e74b15f78f9b411313f0c510ed6 | 95d64039f6d785c4b5af789c3738ad699c8fe8f6 | olli-ai/jx | /pkg/kube/validate.go | Go | go | 1,757 | permissive | package kube
import (
"fmt"
"strings"
"github.com/jenkins-x/jx-api/pkg/client/clientset/versioned"
"github.com/olli-ai/jx/v2/pkg/util"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation"
)
const (
OptionName = "name"
OptionNamespace = "namespace"
)
func ValidateSubDo... |
76fed9668e3576fb109d7ff3f0d85b53d0a3b966 | b2c678d39c1c72eaad8121b92023a8c61ed2254c | YotiSandy/gapid | /cmd/gapit/sxs_video.go | Go | go | 13,234 | permissive | // Copyright (C) 2017 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 t... |
fb0299c3a7a0b00b0a96d77a79ffc27cfe335160 | 1103b1f7e35986c7c1d1131373c21dddaa2dbb97 | bradfitz/lesser | /lesser.go | Go | go | 8,088 | permissive | // Copyright 2020 Brad Fitzpatrick. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package lesser generates less functions for sort.Slice.
package lesser
import (
"fmt"
"math"
"reflect"
"unsafe"
)
// Of returns a less function suita... |
3375479fb3e9adc20f38127343414153644c689a | 692e5f4efb6fa42952da254da71d6e9cf920387f | kubernetes/test-infra | /prow/plugins/size/size_test.go | Go | go | 14,741 | 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, ... |
5d64852442af9939f23636c7464bf2a822ad613a | 364be028a2633766cdb636df1385f46f1564a1ae | youyo/gaws | /cmd/completion_zsh.go | Go | go | 1,803 | permissive | // Copyright © 2019 youyo <1003ni2@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
fdbbb5e94c7bb95ca390a47e61b539411a020117 | 1c5591c2d5038a8b30968b8b381e6d33912d6ac6 | hulunbao/golang | /A_Tour_of_Go/maps.go | Go | go | 224 | no_license | package main
import "fmt"
type Vertex4 struct{
Lat,Long float64
}
var m map[string]Vertex4
func main() {
m = make(map[string]Vertex4)
m["Bell Labs"] = Vertex4{
40.63844,-74.39967,
}
fmt.Println(m["Bell Labs"])
}
|
0ff9ba05fb97184172cf4c8dbdf2942de06a623b | 061e6b830665b82fa34efda09d90762f3b62415a | md-raghib/backup | /OrgStructure/resource_agility_createcontainer.go | Go | go | 3,644 | no_license | package OrgStructure
import (
"log"
"os"
"encoding/json"
"github.com/csc/csc-agility-terraform-provider-plug-in/api"
"github.com/hashicorp/terraform/helper/schema"
"github.com/csc/csc-agility-terraform-provider-plug-in/Resource"
)
/*type Container struct{
XMLName struct{} `xml:"container"`
Name string `x... |
9ba85caa05cb3296b378617ecacab56fb9322dd5 | 4ce022b56d7056193bcae17a9a1349fb469b0b52 | kastenhq/ibmcloud-storage-volume-lib | /provider/local/provider.go | Go | go | 2,005 | permissive | /*******************************************************************************
* IBM Confidential
* OCO Source Materials
* IBM Cloud Container Service, 5737-D43
* (C) Copyright IBM Corp. 2018 All Rights Reserved.
* The source code for this program is not published or otherwise divested of
* its trade secrets, ... |
a2722c605ca889ad0fb9a8cc0a4dc415371a1e40 | 3b5c07ef3487565b9179095ad9b11882d7714927 | jianh619/cloudpak-provider | /cmd/provider/main.go | Go | go | 2,638 | permissive | /*
Copyright 2020 The Crossplane 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, ... |
e451fce822ca00f31ba2e137039623ab773b80c9 | 52af6d02fd020e86d77813df037518b9b87ef623 | gtrevg/golang | /third_party/google.golang.org/grpc/status/details_bad_request.go | Go | go | 576 | permissive | package status
import "google.golang.org/genproto/googleapis/rpc/errdetails"
// WithBadRequestDetails returns a new status with the provided bad requests messages appended to the status.
func WithBadRequestDetails(s *Status, descByField map[string]string) *Status {
if len(descByField) == 0 {
return s
}
var badRe... |
8c3d17a8c9d5d1ed2de706a5410c205185f64a45 | b44794276840842f6536c38e19011401ae0eeca4 | JenniO/bookstore_users-api | /datasources/mysql/users_db/users_db.go | Go | go | 907 | no_license | package users_db
import (
"database/sql"
"fmt"
"github.com/JenniO/bookstore_utils-go/logger"
"github.com/go-sql-driver/mysql"
_ "github.com/go-sql-driver/mysql"
"log"
"os"
)
const (
mysqlUsersUsername = "mysql_users_username"
mysqlUsersPassword = "mysql_users_password"
mysqlUsersHost = "mysql_users_host... |
640b5e2eba28644d6c5e1f13750d7e5afba081c7 | bfcb1235cbfa28e4467d9f5ee958f57ef5a8d069 | nablahero/u-root | /pkg/securelaunch/policy/policy.go | Go | go | 6,611 | permissive | // Copyright 2019 the u-root 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 policy locates and parses a JSON policy file.
package policy
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/fi... |
938659d299b35a259d8b8244003a39a79c35653d | b5a5a8d4290ced4f60cb064ab31f52fb727eafcd | nabla-containers/gorump | /go1.5/src/cmd/link/internal/ld/macho_combine_dwarf.go | Go | go | 10,837 | permissive | // Copyright 2015 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 ld
import (
"bytes"
"debug/macho"
"encoding/binary"
"fmt"
"io"
"os"
"reflect"
"unsafe"
)
var fakedwarf, realdwarf, linkseg *macho.Segment
var ... |
31d4b7b907f83e93d2dd816ffe58e2d734dc88e2 | 9cfae4555e9dc19d79fffdcbb40877ec87d9a6ae | skavronsky/nuclio | /pkg/platform/factory/factory.go | Go | go | 3,690 | permissive | /*
Copyright 2017 The Nuclio 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... |
e4b0fa4dfbd718d3a99e2e9c7cb199c71e5feb23 | 9b5266b1d8760607a5d48586d18419023e6bf680 | Azure/ARO-RP | /vendor/github.com/microsoftgraph/msgraph-sdk-go/users/item_calendar_events_item_instances_item_forward_request_builder.go | Go | go | 5,394 | permissive | package users
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
)
// ItemCalendarEventsItemInstanc... |
71262848450339ba20ea573034b04e34186ef847 | 2bc59a568ee5b6d2f41451c43b9b3062e70cb667 | soccp/grid | /vendor/github.com/coreos/etcd/store/stats.go | Go | go | 3,889 | 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 ... |
01babf5c8680a028f25e12c35e25bba78162742a | c106d8210cbba641642a588dbdede79c443463b1 | bketelsen/hcsshim | /test/functional/lcow_test.go | Go | go | 7,803 | permissive | // +build functional lcow
package functional
import (
"bytes"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"
"github.com/Microsoft/hcsshim/internal/hcs"
"github.com/Microsoft/hcsshim/internal/hcsoci"
"github.com/Microsoft/hcsshim/internal/lcow"
"github.com/Microsoft/hcsshim/internal/uvm"... |
7393818e51b4e5abec602afcd7301855c12a1b33 | 2a6fa6282cd5ff4a9d6410d1584d4840d3dffe3e | huaweicloud/huaweicloud-sdk-go-v3 | /services/sms/v3/model/model_show_cert_key_response.go | Go | go | 540 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ShowCertKeyResponse Response Object
type ShowCertKeyResponse struct {
// 证书
Cert *string `json:"cert,omitempty"`
// 私钥
PrivateKey *string `json:"private_key,omitempty"`
HttpStatusCode int `json:"-"`
}
fu... |
1c6717b862b538784f52995106b5e0e9de3db0fc | 990cfdfe65b57f09b58ae65bb1914a8f152f9ab5 | doudouwyh/ml_algorithm | /hmm/hmm.go | Go | go | 2,784 | no_license | package hmm
import (
"wh_ml/lib"
"fmt"
)
const(
Sunny int = 0
Cloudy int = 1
Rainny int =2
Dry int =0
Dryish int = 1
Damp int = 2
Soggy int = 3
)
var flags []int
/******************************************************
transition matrix:
sunny cloudy rainy
sunny 0.5 0.375 0.125
cloudy 0.25 0... |
c12a4dcf07dc22528ddbc012b0da6e8aea3609b8 | f913dc485056a732e03f2adb7c5a573ed3f7df34 | hookttg/go-1 | /helpers/img.go | Go | go | 3,169 | no_license | package helpers
import (
"encoding/base64"
"errors"
"strings"
"io/ioutil"
"bytes"
"sync"
"os"
"strconv"
"path"
"image"
"image/png"
"image/jpeg"
"image/gif"
"github.com/nfnt/resize"
"time"
)
var (
//ErrBucket = errors.New("Invalid bucket!")
//ErrSize = errors.New("Invalid size!")
ErrI... |
e382b7b74fd66eabf4c79616826eb286edcd40dc | af9369af05ee83eadd948074d19dcc63bcbc5d1b | innerpeacez/skywalking-banyandb | /banyand/tsdb/shard.go | Go | go | 10,130 | permissive | // Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "Li... |
68f4631d54af0dc9a859f3d81b334c6ddfb50aea | 0d320b9e1694dac5c20291bee5a9917561cb4d03 | bububa/opentaobao | /model/store/TopBatchResultDo.go | Go | go | 693 | permissive | package store
// TopBatchResultDo 结构体
type TopBatchResultDo struct {
// 失败的门店id
ResultList []int64 `json:"result_list,omitempty" xml:"result_list>int64,omitempty"`
// 错误码
ErrorCode string `json:"error_code,omitempty" xml:"error_code,omitempty"`
// 错误信息
ErrorMsg string `json:"error_msg,omitempty" xml:"error_msg,o... |
173f76501a75f50d25fdaaa128802fff6479d88d | e7c4b5be44e9a2e246f0afbf691ccf3ceddb17de | twiest/hive | /pkg/controller/remotemachineset/awsactuator.go | Go | go | 18,272 | permissive | package remotemachineset
import (
"context"
"fmt"
"regexp"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/blang/semver/v4"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachi... |
f8e74d6c9ebabd0202cde81bfbe17ba82ddd5061 | 59b9846b65133aa0b0b23e27af3aac1b29f0d0e6 | chancez/mantle | /Godeps/_workspace/src/github.com/gogo/protobuf/proto/proto3_test.go | Go | go | 4,176 | permissive | // Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2014 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met... |
bc72685680025f095fc6d92157cf532203861427 | f5b3622feba728610cd29b4238c221d44d3f21d9 | briand787b/learning_go | /77_https/router.go | Go | go | 203 | no_license | package main
import (
"github.com/gorilla/mux"
)
const (
// request keys for mux vars
nameReqKey = "name"
)
func prepareRouter(r *mux.Router) {
registerHelloHandlers(r)
registerHomeHandlers(r)
}
|
799fa6224b8b7c0779648ea0dbbcc558470857ac | d13be5b1e17456bad7d5cdea3bdd354d449fbc91 | hiwjd/mysql2nsq | /data_changed_test.go | Go | go | 831 | no_license | package mysql2nsq
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEncodeDecode(t *testing.T) {
dc := &DataChanged{}
dc.Action = INSERT
dc.Schema = "db1"
dc.Table = "user"
dc.Rows = []map[string]interface{}{{"id": 1, "name": "hiwjd"}}
bs, err := dc.Encode()
assert.Nil(t, err)
dc2 := &Da... |
d9f0563b31c224c00366d151b85137d0c7bff88e | c3efcb60ef2d75ef1017651a53c51ec3103335ff | tymonx/go-color | /color.go | Go | go | 18,363 | permissive | package color
import (
"fmt"
"io"
"os"
"strconv"
"strings"
"sync"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
)
var (
// NoColor defines if the output is colorized or not. It's dynamically set to
// false or true based on the stdout's file descriptor referring to a terminal
// or not. Thi... |
d180feff06c7d88acad3dbaeca5852e2fc3fcfc2 | b32c9e41154283e1cce732732f6cb7efcd9a5572 | 2019-b-gr2-fundamentos/fund-rodriguez-machado-francisco-xavier | /mi carpeta/GO/Variables-primitivas.go | Go | go | 502 | no_license | /*
Autor: Francisco Rodriguez
Fecha actializacion: 24/10/2019
Descripcion: Variables primitivas GO
Variables primitivas:
1.- Int - Numero Entero Ej: 4 5 6 8
2.- Char -- se utiliza para declarar la palabra clave de una estructura Ej: Positivo, Nulo
3.- comple (x64 y x128) --- Ej: Números complejos con float32 / 64 p... |
dda054dcdbd729f7bf664952a54e2f9b3689e089 | afe087b748133c889e7eccbc998f56096677787b | andywahr/ARO-RP | /pkg/util/azureclient/mgmt/dns/zones_addons.go | Go | go | 805 | permissive | package dns
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"context"
"github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns"
)
// ZonesClientAddons contains addons for ZonesClient
type ZonesClientAddons interface {
ListByResourceGroup(ctx context.Context, ... |
a535c22edf1d0ed2ceba20a98b598e5c99efc003 | dca3a5f4c63a68e1a2c15e27c5d25ac5cf00034f | crscillitoe/sourcegraph | /enterprise/internal/codeintel/stores/dbstore/commits_test.go | Go | go | 16,299 | permissive | package dbstore
import (
"context"
"fmt"
"sort"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/commitgraph"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/gitserver"
"github.com/sourcegraph/sourcegraph/internal/db/dbconn... |
ebefe90aef4a3fe179f55ae4ef1310bb6931c3da | 6ecad14a8a4e7c59cdebdcb9b4b1853b603585b2 | chaunceyt/go-examples | /webproject-api-using-gin/webproject/main.go | Go | go | 1,645 | no_license | package main
//@TODO
// - Check to see if object exists and update it. Similar to the kubectl apply -f filename.yaml
// - Sidecar support
import (
"flag"
"path/filepath"
"github.com/gin-gonic/gin"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
)
// WebProjectI... |
5592e19342ef11e1201bdfe478cc5f2373512ed9 | af8e2965981ed9c5ade55ae44870a9ca4631d57c | hugohsiaowvt/CMS | /models/users.go | Go | go | 790 | no_license | package models
import (
"github.com/astaxie/beego/orm"
)
const (
STATUS_OK = 1
STATUS_NOTOK = -1
)
type Users struct {
Id int `orm:"column(id)"`
Account string `orm:"column(account)"`
Password string `orm:"column(password)"`
Name string `orm:"column(name)"`
Email string `orm:"column(email)"`
LoginTime... |
a732c4f6fc40156ade7c51695d6de28a38a4aede | e3e3a6075b28adb2283dd100c3977ae3adc8ee0e | alvinlin123/opentelemetry-collector | /translator/trace/jaeger/jaegerthrift_to_traces.go | Go | go | 5,779 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
cab3bde343adfa42d2b362b93e2a7960e3b8df9b | f8382b5e33fa9101d7c56b775df343d2a5b69562 | rafael977/exp-quicksort | /pkg/sort/common.go | Go | go | 271 | no_license | package sort
func swap(arr []int, i, j int) {
arr[i], arr[j] = arr[j], arr[i]
}
func rotate(arr []int, index ...int) {
tmp := arr[index[0]]
for i := range index {
if i == len(index)-1 {
arr[index[i]] = tmp
} else {
arr[index[i]] = arr[index[i+1]]
}
}
}
|
0e306aaaae588297d1a4379593c010f3399395b0 | 1434cd3247d299aa0cd3a29620a1d400ccb5f1c1 | atmos/conveyor | /cmd/conveyor/worker.go | Go | go | 2,069 | permissive | package main
import (
"os"
"os/signal"
"runtime"
"syscall"
"github.com/codegangsta/cli"
"github.com/remind101/conveyor"
"github.com/remind101/conveyor/builder/docker"
"github.com/remind101/conveyor/worker"
)
// flags for the worker.
var workerFlags = []cli.Flag{
cli.StringFlag{
Name: "github.token",
V... |
4526d6bebaad034c7097daa14766eae226802137 | e6346ee154483a7c8f877a132652df4a1ca03e7b | tbh1/impact | /cmd/export.go | Go | go | 1,672 | permissive | // Copyright © 2016 NAME HERE <EMAIL ADDRESS>
//
// 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 ... |
d05e75f92746aa18209a975e3972a8473cd9882f | f011835dc8025917f179cf99ff3da4ca341ef0b8 | PhilippSalvisberg/gitbase | /vendor/gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletmanager/vreplication/stats.go | Go | go | 5,832 | permissive | /*
Copyright 2018 The Vitess 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... |
ca54465c1fe94b7966a4bd5c81317f00068a9f34 | 7e4724dafd93a857e7006c453b6c1c0b7314ff14 | monjovi/justforfunc | /vendor/gonum.org/v1/plot/plotter/scatterColor_test.go | Go | go | 2,980 | permissive | // Copyright ©2015 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 plotter
import (
"fmt"
"log"
"math"
"math/rand"
"os"
"testing"
"gonum.org/v1/plot"
"gonum.org/v1/plot/internal/cmpimg"
"gonum.org/v1/plot... |
3ae79a4eb03f3c7ac6ba125f23f775d702a8be66 | da80d88f68c4c9bccf9b60829992d01945958115 | zhengruyi/GoProgrammingLanguage | /Go语言圣经/ch3/surface.go | Go | go | 1,015 | no_license | package main
import (
"fmt"
"math"
)
const (
width,height = 600,320
cells = 100
xyrange = 30.0
xyscale = width /2 /xyrange
zscale = height * 0.4
angle = math.Pi / 6
)
var sin30, cos30 = math.Sin(angle), math.Cos(angle)
func main() {
fmt.Printf("<svg xmlns='http://www.w3.org/2000/svg'" +
"style='stroke: g... |
87118ea633378194598d2d2d164492ca581311ea | 3c93ccbb4eee72dbcb82cf34f4a324d4c718cd05 | jrzimmerman/gads | /v201603/cli/partial_failure.go | Go | go | 815 | permissive | package main
import (
"flag"
"fmt"
gads "github.com/colinmutter/gads/v201603"
"log"
)
var configJson = flag.String("oauth", "./oauth.json", "API credentials")
func main() {
flag.Parse()
config, err := gads.NewCredentialsFromFile(*configJson)
if err != nil {
log.Fatal(err)
}
config.Auth.PartialFailure = ... |
09441c77aad8df4de2255d2fc3a95bc07e6c6c70 | 9ebc7e4499703a80bb8a827ac2107a1dd23832a1 | jhutchings1/zitadel | /internal/api/grpc/auth/user_session_converter.go | Go | go | 1,272 | permissive | package auth
import (
auth_req_model "github.com/caos/zitadel/internal/auth_request/model"
usr_model "github.com/caos/zitadel/internal/user/model"
"github.com/caos/zitadel/pkg/grpc/auth"
)
func userSessionViewsFromModel(userSessions []*usr_model.UserSessionView) []*auth.UserSessionView {
converted := make([]*auth... |
badcfc8f9107b40e89a28feb70b1e58597364535 | 67e95a8da35e421898469f0160d1eb4df1a8db7c | hupiper/quay-operator | /controllers/redhatcop/quayecosystem_controller.go | Go | go | 11,804 | no_license | /*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License... |
86a464489e0d6b77b6f773fc30d8d21860678088 | 5bb7a68420e5ce97d5dfbd1bcc82230d26237b71 | louisliu2048/cosmos-sdk | /orm/model/ormdb/module_test.go | Go | go | 10,483 | permissive | package ormdb_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"strings"
"testing"
ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1"
"github.com/golang/mock/gomock"
"github.com/cosmos/cosmos-sdk/orm/testing/ormmocks"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
"github.com/c... |
b187d2324668fc7dfb7350f019e5b5cde432eaa1 | 2172adaa427044e1e996a076496b446d16fb7c75 | syfwyt/startGolLand | /http/controller/download.go | Go | go | 4,234 | permissive | // Copyright 2017 The StudyGolang Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// http://studygolang.com
// Author: polaris polaris@studygolang.com
package controller
import (
"fmt"
"net/http"
"regexp"
"strings"
"time"
"gi... |
ab14faa1af9f365f85e12606f1b55994e9fced28 | 66c469e03f376a2e804fe1d3997f0c3f99958f5a | quintans/goSQL | /db/entity_tree_transformer.go | Go | go | 9,053 | permissive | package db
import (
"github.com/quintans/faults"
tk "github.com/quintans/toolkit"
coll "github.com/quintans/toolkit/collections"
"github.com/quintans/toolkit/ext"
"database/sql"
"reflect"
)
//extends EntityTransformer
type EntityTreeTransformer struct {
EntityTransformer
reuse bool
crawler ... |
8227066a2621e2d2566fe8b3f177a8b0d4e8d191 | 986ff73178dc706b3f1386a716a71dc885a3f98e | tokamoto-idcf/vsphere-csi-driver | /pkg/common/cns-lib/vsphere/utils.go | Go | go | 16,623 | permissive | package vsphere
import (
"context"
"crypto/tls"
"encoding/pem"
"errors"
"fmt"
"net/url"
"reflect"
"strconv"
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/vmware/govmomi/cns"
cnstypes "github.com/vmware/govmomi/cns/types"
"github.com/vmware/govmomi/sts"
"github.com/vmware/govmomi/vapi/rest"
"g... |
f6dfaa5dc6aea2f4fb5960797698762f752bc83d | 2f3fa0bd0467993004d2a9c103775d136d9393fe | StruggleYi/fabric | /orderer/consensus/migration/migration_test.go | Go | go | 17,162 | permissive | // Copyright IBM Corp. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package migration_test
import (
"fmt"
"testing"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/orderer/consensus/migration"
"github.com/hyperledger/fabric/orderer/consensus/mocks"
"github.com/hyperledger/fabri... |
0ace419f1d96c80e010d7caced660424ceb1fa67 | 7b61748221e2e2efa4286f9e03caaffdf4eb5993 | alankm/direktiv | /pkg/flow/metrics.go | Go | go | 9,062 | permissive | package flow
import (
"context"
"net"
"net/http"
"time"
"github.com/direktiv/direktiv/pkg/flow/grpc"
"github.com/direktiv/direktiv/pkg/metrics"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
type metricsServer struct {
*... |
f3741d1ce1abc9fce198a4c5768f381b46a64f3d | f75c5e453d9af4f01e476788e9919023b54f8a24 | joomcode/gogoprotobuf | /plugin/marshalto/marshalto.go | Go | go | 36,535 | permissive | // Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
// http://github.com/pixty/gogoprotobuf
//
// 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 ... |
d6b73fe808eb91388ead5257ec9a2a75ce7e2d34 | aa1d063dd85737f671378702af07541f3c791a3c | manyiu/leetcode | /169_majority-element/main_test.go | Go | go | 358 | no_license | package majorityelement
import "testing"
func TestMajorityElement(t *testing.T) {
tests := []struct {
nums []int
want int
}{
{[]int{3, 2, 3}, 3},
{[]int{2, 2, 1, 1, 1, 2, 2}, 2},
}
for _, tt := range tests {
if got := majorityElement(tt.nums); got != tt.want {
t.Errorf("majorityElement(%v) = %v, want... |
f2e6e3458cdcfd7e6f796693ad555500ffb74a6e | 7d9d6e2954b22c2ca87f7ea46467694922e7700b | aaronjen/rate-limiter | /handler/getHandler.go | Go | go | 669 | no_license | package handler
import (
"strconv"
"sync"
"time"
"github.com/gofiber/fiber/v2"
)
type record struct {
nTimes int
expirationTime time.Time
}
var lock sync.Mutex
var m map[string]record = map[string]record{}
// GetHandler handle / request
func (h Handler) GetHandler(c *fiber.Ctx) error {
ip := c.IP()
... |
3c01774d40a1768bc46eb035ad20f1c12d23a6c2 | b107256140abd6ca6684537a31366cafcb67bea1 | adamdecaf/zlint | /lints/lint_utc_time_does_not_include_seconds.go | Go | go | 2,201 | no_license | // lint_utc_time_does_not_include_seconds.go
/************************************************************************
4.1.2.5.1. UTCTime
The universal time type, UTCTime, is a standard ASN.1 type intended
for representation of dates and time. UTCTime specifies the year
through the two low-order digits and time is sp... |
dbd96592eda1a9d28e8e710d27c07e65df580470 | 525e60a3078c29d8294dbb7fa9cbd4c5a6f241d2 | pallcard/gocode | /src/bookstore/controller/userhandler.go | Go | go | 1,218 | no_license | package controller
import (
"bookstore/dao"
"html/template"
"net/http"
)
func Login(w http.ResponseWriter, r *http.Request) {
username:=r.PostFormValue("username")
password:=r.PostFormValue("password")
user,_ := dao.CheckUserNameAndPassword(username, password)
if user.ID > 0 {
t := template.Must(template.Par... |
9b6e41321ce8798d07b93c72fdebd6b1cc5da237 | 35fa71b1210209f47b707170e5caf152f80e4038 | zekroTJA/shinpuru | /internal/models/guildlog.go | Go | go | 483 | permissive | package models
import (
"time"
"github.com/bwmarrin/snowflake"
)
type GuildLogSeverity int
const (
GLAll GuildLogSeverity = iota - 1
GLDebug
GLInfo
GLWarn
GLError
GLFatal
)
type GuildLogEntry struct {
ID snowflake.ID `json:"id"`
GuildID string `json:"guildid"`
Module string ... |
efc0f4c02dc2ffbc8cb4f6554cf98d8edd99fdf7 | 1d25fb85d5f453cfd84a3013e99249d7c0966ac5 | breml/rubydebug | /json_test.go | Go | go | 1,777 | permissive | package rubydebug
import (
"encoding/json"
"testing"
)
func TestToJSON(t *testing.T) {
cases := []struct {
rubydebug string
json string
}{
{
rubydebug: `{
"message" => "test",
"@version" => "1",
"@timestamp" => "2017-01-19T19:19:55.517Z",
"bla" => {
"foo" => "bar"... |
3ee1b4a68e2de3086afa5ee0764673593414cea8 | b18958cda08ecbb9b0baf52644b605bcd6e6fc6c | kubernetes/autoscaler | /cluster-autoscaler/cloudprovider/oci/vendor-internal/github.com/oracle/oci-go-sdk/v65/containerengine/oci_vcn_ip_native_node_pool_pod_network_option_details.go | Go | go | 2,673 | permissive | // Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
45a175cf36bbfcfc5ab5a9df2591b0c6f8a58f5e | 5633d88133a753e36f665de51605df4070b80e9c | jason12360/goav | /example/tutorial04.go | Go | go | 9,666 | permissive | package main
import (
"fmt"
"github.com/giorgisio/goav/avcodec"
"github.com/giorgisio/goav/avformat"
"github.com/giorgisio/goav/avutil"
"log"
"unsafe"
)
const OUTPUT_VIDEO_CODEC = "libx265"
const OUTPUT_CODEC_PRIV_KEY = "x265-params"
const OUTPUT_CODEC_PRIV_VALUE = "keyint=60:min-keyint=60:scenecut=0"
func Cre... |
984c672bc0d43592e8f3b369c7beec67a886376c | 13c358e88e69787d8003ee6fb4944a59633da407 | UndiedGamer/Golang-Calculator | /calculator.go | Go | go | 1,349 | no_license | package main
import (
"fmt"
"strings"
)
func calc() {
fmt.Println("What operation do you want to do: ")
fmt.Println("Type 'add' or 'subtract' or 'divide' or 'multiply'")
var Option string
fmt.Scanln(&Option)
var Input = strings.ToLower(Option)
if Input == "add" || Input == "a" {
fmt.Println(... |
e2ea9c85d970073070509a6374530698fa924211 | e2a6525766b4df1aca8e4f15c6e11fb7619864e5 | sergi/kubernetes | /pkg/kubectl/cmd/set/set_resources_test.go | Go | go | 13,670 | 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, ... |
033b3c03b4d6d1870e02cfa3a174429f55b63344 | d1d5aa93057351571edc370bb619ec8374836191 | richterdavid/eventing | /pkg/reconciler/pingsource/controller/controller.go | Go | go | 3,738 | permissive | /*
Copyright 2020 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... |
c98a3367a4559c080c7c71ef75a5429d4e7485b7 | 10c888049ba3f7323509c4e0629e197d6b715758 | elliottcarlson/goingo | /protoc-gen-goingo/main.go | Go | go | 5,231 | no_license | package main
import (
"flag"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
descriptors "github.com/golang/protobuf/protoc-gen-go/descriptor"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/proto"
)
func check(err error) {
if err != nil {
panic(err)
}
}
func m... |
95b085e09670e7d86c57e9dd93a2fa08a32a0d17 | 164188a58185068704579d47fc03b49ccfdf57ed | bote795/astro-cli | /cmd/root.go | Go | go | 1,384 | permissive | package cmd
import (
"io"
"github.com/spf13/cobra"
"github.com/astronomer/astro-cli/houston"
"github.com/astronomer/astro-cli/version"
)
var (
workspaceId string
workspaceRole string
role string
skipVerCheck bool
)
// NewRootCmd adds all of the primary commands for the cli
func NewRootCmd(clien... |
9f2a856f1f958d9048cb86259b2fef16ad464c0c | 21ff2d8058044715a995be6000d5c19518f30a50 | aws/amazon-ecs-agent | /agent/tools.go | Go | go | 1,025 | permissive | //go:build tools
// +build tools
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
/... |
8ff562ee32bafe1bcc5ab2cbbea5aa4053cf6363 | 8c443e8bc5993cb0f4a95bbdad1fc34de4f10b57 | se77en/db | /error.go | Go | go | 3,168 | permissive | // Copyright (c) 2012-2014 The upper.io/db authors. All rights reserved.
//
// 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 ... |
cfdeca9d63e705f31d615b9dde06fb6daaf46c51 | 99852cc8c43ba266f3f3047cf932b67f67bcf69f | jason860306/ipfs_demo | /ipfs_demo.go | Go | go | 7,261 | permissive | package main
import (
"fmt"
"os"
//"flag"
"bufio"
"bytes"
"path/filepath"
"runtime"
"strconv"
"time"
"github.com/mitchellh/go-homedir"
"github.com/op/go-logging"
//"github.com/ipfs/go-ipfs/commands"
//"github.com/ipfs/go-ipfs/repo/config"
//"github.com/ipfs/go-ipfs/repo/fsrepo"
"github.com/jason86030... |
ad9dd84107d0c21e6bf493f5d1d6ebac005eda94 | a136da21a5bb9ceeeae5547399bcbcf112997695 | workato/gvisor | /runsc/boot/loader.go | Go | go | 41,136 | permissive | // Copyright 2018 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... |
ddcf38191c681844b0afa5b3776f2416cfd0d1bd | bdbbdfd7e2311ae5b98ecf7b24b0b2e7127685ce | xinjiayu/incore | /hostlet/ipm/ipm.go | Go | go | 6,064 | permissive | // Copyright 2015 Eryx <evorui аt gmаil dοt cοm>, All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless re... |
fd6e91a4dfdea90106c3100018133e936fc463c8 | 17f28bbb17bc4f879442756ce69f50d33fbff153 | prateekpandey14/orchestrator | /go/process/election_dao.go | Go | go | 3,792 | permissive | /*
Copyright 2015 Shlomi Noach, courtesy Booking.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 ... |
ba24e7628e532d69d6456b8926b7363aed9bc6b6 | d52c026f2d4ea6c6d36e7a5c1123a44615d6da1f | NateWilliams2/mattermost-plugin-github | /server/client/client.go | Go | go | 2,646 | permissive | package client
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"github.com/google/go-github/v31/github"
"github.com/pkg/errors"
"golang.org/x/oauth2"
"github.com/mattermost/mattermost-plugin-github/server/plugin"
)
type PluginAPI interface {
PluginHTTP(*http.Request) *http.Response
}
type Client... |
8034ebb879a5e285c800cea8e6330f420cd4fd6e | 889137c8cfc1b4bb92ada011d0356bdd6eca3f02 | yakuter/gitbatch | /internal/command/commit.go | Go | go | 1,884 | permissive | package command
import (
"fmt"
"time"
giterr "github.com/isacikgoz/gitbatch/internal/errors"
"github.com/isacikgoz/gitbatch/internal/git"
gogit "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)
// CommitOptions defines the rules for commit operation
type CommitOptions struct {
// CommitM... |
c0d62f8474c00f62a18d35f8901d3b4287b61f2b | 3d75a7f723ca1fc5c1939b4e0103fc6b260bf979 | mdumandag/hazelcast-go-client | /core/logger/default_logger_test.go | Go | go | 2,751 | permissive | // Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License")
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by a... |
7c1adc076d788d927cfad047eed1712ade0b75bb | 4dd2a63786dc04f1bf8bc5782cc34c82f2dc14cc | xNok/slack | /misc_test.go | Go | go | 2,755 | permissive | package slack
import (
"context"
"log"
"net/http"
"net/url"
"sync"
"testing"
"github.com/slack-go/slack/internal/misc"
"github.com/slack-go/slack/slackutilsx"
)
var (
parseResponseOnce sync.Once
)
func parseResponseHandler(rw http.ResponseWriter, r *http.Request) {
rw.Header().Set("Content-Type", "applic... |
e8383759e62c173eef0b96aade31d54c74d284aa | 1c975f63e3d52af6c14d61704fd8d73e4df5f1c8 | rancher/cluster-controller | /vendor/github.com/rancher/rke/cluster/reconcile.go | Go | go | 7,611 | permissive | package cluster
import (
"context"
"fmt"
"github.com/rancher/rke/hosts"
"github.com/rancher/rke/k8s"
"github.com/rancher/rke/log"
"github.com/rancher/rke/services"
"github.com/sirupsen/logrus"
"k8s.io/client-go/kubernetes"
)
const (
taintKey = "node-role.kubernetes.io/etcd"
)
func ReconcileCluster(ctx cont... |
4773250259adbfee49dac3345a0137130c7754df | 5f54865181746a75f6d520d95d6aae52d7308008 | saimohanreddyt/DS_Go_Assignment-2 | /1quick_sort.go | Go | go | 1,734 | no_license | //Quick-Sort
//-x-x-x-x-x-
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
slice := generateSlice(20)
fmt.Println("\n--- Unsorted --- \n\n", slice)
quicksort(slice)
fmt.Println("\n--- Sorted ---\n\n", slice, "\n")
}
// Generates a slice of size, size filled with random nu... |
fdda4c3dae630a736bfef8ffb84ee6ee909750e0 | e343166ed5a43ec45e316e4b4c9593fed9f66bbc | amrikmalhans/go-microservices | /handlers/hello.go | Go | go | 419 | no_license | package handlers
import (
"fmt"
"log"
"net/http"
"io/ioutil"
)
type Hello struct {
l *log.Logger
}
func NewHello(l *log.Logger) *Hello {
return &Hello{l}
}
func (h *Hello) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
h.l.Println("Hello World")
d, err := ioutil.ReadAll(r.Body)
if err != nil {
htt... |
92a50270615f4f88dac9997917a06ea9f7aebbbf | cacdfbe3d525b9eef041555c976a16c937fd3689 | huaweicloud/huaweicloud-sdk-go-v3 | /services/dataartsstudio/v1/model/model_tag_header.go | Go | go | 658 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
type TagHeader struct {
// 资产名称
Name *string `json:"name,omitempty"`
// 标签描述
Dexcription *interface{} `json:"dexcription,omitempty"`
// 标签的名称
DisplayText *string `json:"display_text,omitempty"`
// 关联的guid
Relat... |
2bf7ab5a814b8d85cd2bf8a1d58c80ed569e66ad | b7a656e8f443ff725e0dc167874574000ef94874 | busoc/mmaconv | /cmd/check/main.go | Go | go | 1,819 | no_license | package main
import (
"compress/gzip"
"encoding/csv"
"flag"
"fmt"
"io"
"os"
"strconv"
"time"
"github.com/busoc/mmaconv"
)
const (
Diff = time.Microsecond * 750
Format = "2006-01-02 15:04:05.000000"
Pattern = "%d: %s - %s => diff: %10s (prev: %6d, curr: %6d, delta: %6d)"
)
func main() {
mindur := fl... |
2a4e0bf323af0cbc301a0f60d704c037048a82da | ebbdbf466d85a7418679c7b6cd85cc69b7cd5137 | blueplus/skynet2 | /client/serviceclient_test.go | Go | go | 4,207 | permissive | package client
import (
"github.com/skynetservices/skynet2"
"github.com/skynetservices/skynet2/client/conn"
"github.com/skynetservices/skynet2/test"
"labix.org/v2/mgo/bson"
"testing"
"time"
)
// TODO: Test Send()
// TODO: Test SendOnce()
// TODO: Test SendTimeout()
// TODO: Test SendOnceTimeout()
// TODO: Test ... |
2902627bb66cd37541e6c58ec1c9dc40ea2bafc5 | 9f9797623a720195fe0020494e37b65f84c4717e | MecaCho/web_server_gin | /pkg/service/tools/jwt_token.go | Go | go | 1,839 | no_license | package tools
import (
"fmt"
"github.com/dgrijalva/jwt-go"
"github.com/golang/glog"
"math"
"strconv"
"time"
"web_server_gin/pkg/model/authmgr"
)
// GetUserToken ...
func GetUserToken(user authmgr.User, expireMinutes time.Duration) (token string, timeExpire time.Time, err error) {
timeExpire = time.Now().Add(... |
746d86bc4c9168480a93f1d2a2ef5be1152a2026 | 3179af0e6e4bd2398080865cf1b1775139cb8735 | vps2/agouti | /matchers/page_matchers_test.go | Go | go | 3,354 | permissive | package matchers_test
import (
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vps2/agouti"
. "github.com/vps2/agouti/matchers"
"github.com/vps2/agouti/matchers/internal/mocks"
)
var _ = Describe("Page Matchers", func() {
var page *mocks.Page
BeforeEach(func() {
page = &mocks.Page... |
fa6fb32ab009e27d4268c930da4095bf50d7d641 | c56d99de559593e5b72772e42b04b3faee292589 | grailbio/reflow | /trace/localtrace/localtracer.go | Go | go | 8,203 | permissive | package localtrace
import (
"context"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"os"
"sync"
"sync/atomic"
"time"
"github.com/grailbio/base/digest"
"github.com/grailbio/infra"
"github.com/grailbio/reflow"
"github.com/grailbio/reflow/taskdb"
"github.com/grailbio/reflow/trace"
)
func init() {
in... |
d04cfc1fa9749704efbf6f1617474a9b9960a47a | 27c91ad64dd263782c411d165e9a1a5b7b889a0f | xieshang728/learn-go | /http/client.go | Go | go | 353 | no_license | package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
)
func main(){
resp,err := http.Get("http://www.imooc.com")
if err != nil {
log.Fatalf("get imooc error %s\n",err)
}
defer resp.Body.Close()
s,err := httputil.DumpResponse(resp,true)
if err != nil{
log.Fatalf("parse body err %s\n",err)
... |
2b90f72e556a68d1430a23920425c0abaaec22cc | 85646f8913466ba61a563a15a7c19b77f4325501 | orisano/wyhash | /blocks.go | Go | go | 419 | permissive | // +build !amd64
package wyhash
import (
"encoding/binary"
)
func consumeBlocks(seed uint64, b []byte) uint64 {
for len(b) > BlockSize {
p := b[:BlockSize]
p1 := binary.LittleEndian.Uint64(p[0:])
p2 := binary.LittleEndian.Uint64(p[8:])
p3 := binary.LittleEndian.Uint64(p[16:])
p4 := binary.LittleEndian.Ui... |
b268450b6b5364b47e9e44b552d3e062cfbcce78 | 9393254432dedea8f70aafc23ece9ad9a61f2536 | ddmchain/ddmchain | /vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go | Go | go | 68,025 | no_license |
// +build 386,freebsd
package unix
import "syscall"
const (
AF_APPLETALK = 0x10
AF_ARP = 0x23
AF_ATM = 0x1e
AF_BLUETOOTH = 0x24
AF_CCITT = 0xa
AF_CHAOS = 0x5
AF_CNT ... |
3d7f0526ad576a8e584d6ac3aed492f77264361f | 263540856b892042bcae45753d5faccc0b79614c | cchung100m/validator | /translations/es/es.go | Go | go | 32,613 | permissive | package es
import (
"fmt"
"log"
"reflect"
"strconv"
"strings"
"time"
"github.com/go-playground/locales"
ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
)
// RegisterDefaultTranslations registers a set of default translations
// for all built in tag's in validator;... |
01e7ca7a8707408ed2194ab9d75645a7bdf7302a | 5957806a5ee5ff9556f0676a542476571fe274d6 | rogeruiz/aws-light-stemcell-builder | /src/light-stemcell-builder/driver/reqinputs/register_image_input.go | Go | go | 1,877 | no_license | package reqinputs
import (
"fmt"
"light-stemcell-builder/resources"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
)
const (
firstDeviceNameHVMAmi = "/dev/xvda"
firstDeviceNamePVAmi = "/dev/sda"
)
// NewHVMAmiRequestInput builds the required input to create an HVM AMI
func NewHVMAmiR... |
0e199466ca46a236db34b4f46d0b77cffa2ac81d | a74462157c22ac9f74abb01bdcf23af2d09a0399 | cafra/study | /unit/mock.go | Go | go | 1,007 | no_license | package unit
import "fmt"
// MessageService 通知客户被收取的费用
type MessageService interface {
SendChargeNotification(int) error
}
// SMSService 是 MessageService 的实现
type SMSService struct{}
// SendChargeNotification 通过 SMS 来告知客户他们被收取费用
// 这就是我们将要模拟的方法
func (sms SMSService) SendChargeNotification(value int) error {
fmt.P... |
b0914abfd49c29577cb9d01df837020c7f831c90 | 30ba80abd388bfd3a2e54937de883bf2aaedf357 | 256dpi/mobiledoc | /parse.go | Go | go | 10,648 | permissive | package mobiledoc
import "fmt"
// Parse will parse the specified raw structure into a document.
func Parse(doc Map) (Document, error) {
// prepare document
d := Document{}
// get version
version, ok := doc["version"].(string)
if !ok {
return d, fmt.Errorf("invalid version")
}
// set version
d.Version = ve... |
46244fdc1cd03b7bd44b098f5fee6cb1bd9587e5 | 305062cca8b6cd0c4322d32d89aafbf3ff3dfb7b | LINBIT/drbd-flex-provision | /vendor/k8s.io/kubernetes/pkg/volume/host_path/host_path.go | Go | go | 10,806 | 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, ... |
483e24deca2806f9f4f3efdc3937ff36ff839d0d | 1bbae0abcaf3382f60b8a9f8302c933ce6bf9f4a | huandu/goroutine | /hack/go1_9/runtime/os_linux_mips64x.go | Go | go | 441 | permissive | // Copyright 2015 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 linux
// +build mips64 mips64le
package runtime
const (
_SS_DISABLE = 2
_NSIG = 129
_SI_USER = 0
_SIG_BLOCK = 1
_SIG_UNBLOCK = 2
... |
f3af995768d5c0c22efc7c983c8fdd839ac26052 | 02ad6375c45374a36584031efa3b08d5a6990be8 | ushioda/go_learn | /ex133/main.go | Go | go | 336 | no_license | package main
import (
"fmt"
"go_learn/ex133/mymath"
)
func main() {
xxi := gen()
for _, v := range xxi {
fmt.Println(mymath.CenteredAvg(v))
}
}
func gen() [][]int {
a := []int{1, 4, 6, 8, 100}
b := []int{0, 8, 10, 1000}
c := []int{9000, 4, 10, 8, 6, 12}
d := []int{123, 744, 140, 200}
e := [][]int{a, b, c... |
a205759e607d6e3e4505f82afc24fdf23dd463ff | 2971e31c937517f90aad49ebd313e3e70678a417 | waixiong/FYP_chat_service | /pkg/handlers/GetMessages.go | Go | go | 674 | no_license | package handlers
import (
"context"
pb "getitqec.com/server/chat/pkg/api/v1"
"getitqec.com/server/chat/pkg/dto"
"getitqec.com/server/chat/pkg/model"
)
type GetMessagesHandler struct {
Model model.ChatModelI
}
func (s *GetMessagesHandler) GetMessages(ctx context.Context, receiverId string) ([]*pb.Message, error... |
88a23ff3830b7a6b8cde7d6483da16e0b01a30fe | 94d2572a3f3c8464ee198a937010dd39982e8c75 | alemic/llgo | /strings.go | Go | go | 4,844 | permissive | // Copyright 2011 The llgo Authors.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package llgo
import (
"code.google.com/p/go.tools/go/types"
"github.com/go-llvm/llvm"
"go/token"
)
func (c *compiler) coerceString(v llvm.Value, typ llvm.Type) llvm.Value {
... |
fe36b89d2bc0f2721542923e01dc004e8d0c5b60 | 164535b144e8679e06585876da11611b6d21da58 | jingax10/kubernetes | /cmd/kubeadm/app/images/images.go | Go | go | 4,570 | 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, ... |
a898a7da82b60af77b4a02b7e28f3fd869b6799a | 604015d47cb99a0fdc8b2bcb5e27fdc3ff359151 | mattfan00/hoji | /server/cmd/migration/main.go | Go | go | 1,151 | no_license | package main
import (
"fmt"
"log"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"github.com/mattfan00/hoji/server/pkg/utl/config"
"github.com/mattfan00/hoji/server/pkg/utl/model"
)
func main() {
config.Init()
opt, err := pg.ParseURL(config.Values.PgURI)
if err != nil {
log.Fatal(err)
}
db :=... |
a3087c5d1e454572842a060c7c584503a3a6a704 | f7ffb2ddc15ac3f2b2b1f1bac69b9d6bf81c86e8 | lhemala/gitea | /modules/storage/local.go | Go | go | 2,807 | permissive | // Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package storage
import (
"context"
"io"
"net/url"
"os"
"path/filepath"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util"
)
var (... |
5ded237f6f8a427fa6db7fe537a548d386864bc0 | 0dcb68861ac65795f7bbe6596b65cfb67a3f05c1 | knabben/sqoop | /ci/pin_repos.go | Go | go | 761 | no_license | package main
import (
version "github.com/solo-io/go-utils/versionutils"
"github.com/solo-io/go-utils/log"
)
func main() {
tomlTree, err := version.ParseToml()
fatalCheck(err, "parsing error")
glooVersion, err := version.GetVersion(version.GlooPkg, tomlTree)
fatalCheck(err, "getting gloo version")
soloKitVer... |
4f1bb52b024b6b51217f9778e07d5f25db9a85cf | 1356a39013cc4f246fef7b20cbf29c82fbacf889 | curx/virtlet | /tests/e2e/e2e_test.go | Go | go | 1,272 | permissive | /*
Copyright 2017 Mirantis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... |
24367cf637cf35605859912b73afeb31094e3072 | 5f7d5169c408239e9b239748c5b39a6faa8cd79b | anthonykrivonos/al-go | /math/primality_test.go | Go | go | 852 | no_license | package math
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestIsPrimeNaive(t *testing.T) {
assert.Equal(t, false, IsPrimeNaive(0))
assert.Equal(t, false, IsPrimeNaive(1))
assert.Equal(t, true, IsPrimeNaive(2))
assert.Equal(t, true, IsPrimeNaive(7))
assert.Equal(t, true, IsPrimeNaive(113))
as... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.