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 |
|---|---|---|---|---|---|---|---|---|
bdddecab6e50027dbc6837154f2474f484520e24 | fd645aad9d57292a3cf18f4021d3e1bf33aee350 | JedBeom/wangunbot | /meal.go | Go | go | 1,041 | no_license | package main
import (
"log"
"net/http"
"time"
sm "github.com/JedBeom/schoolmeal"
)
var (
school = sm.School{
SchoolCode: "Q100005451",
SchoolKindCode: sm.Middle,
Zone: sm.Jeonnam,
}
// 급식 저장용
meals []sm.Meal
// feedback.log
feedback *log.Logger
)
// 급식을 불러옴
func getMeals() {
now :=... |
ceeabe6d361fc0867b88a789273c2b4772431413 | e2ae5e175157897c4a9ab5538ac4184ef769cf10 | preslavmihaylov/adventofcode | /2019/day02/part2/day2_part2.go | Go | go | 1,229 | permissive | package main
import "fmt"
func main() {
targetOutput := 19690720
for noun := 0; noun <= 99; noun++ {
for verb := 0; verb <= 99; verb++ {
program := make([]int, len(initProgram))
copy(program, initProgram)
program[1], program[2] = noun, verb
run(program)
if program[0] == targetOutput {
fmt.Pri... |
36dd100747315a20cb6d113315a0c1c8637db2cd | af7840a960ee21769b359116c36336fb89035d58 | tanjianfeng/gvisor | /pkg/sentry/fsutil/file_range_set.go | Go | go | 8,474 | 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... |
229ba8d72cdb36f51826140ab3900d91b6b241d9 | a0f9befe80c8febd8f0f8fc871363455c89d6883 | Be90nia/Learn | /go_package/main.go | Go | go | 1,122 | no_license | package main
import (
"fmt"
"./tree"
"golang.org/x/tools/container/intsets"
)
type myTreeNode struct {
node *tree.Node
}
func (myNode *myTreeNode) postOrder() {
if myNode == nil || myNode.node == nil {
return
}
left := myTreeNode{myNode.node.Left}
right := myTreeNode{myNode.node.Right}
left.postOrder()
... |
cdb7ee89e09f797d8caae139753f6dacdc210aff | 321d36825ae7520b18453b63004263108979c6eb | codenamejason/chainlink | /core/internal/cltest/factories.go | Go | go | 23,192 | permissive | package cltest
import (
"bytes"
"crypto/rand"
"encoding/binary"
"encoding/json"
"flag"
"fmt"
"math/big"
"net/url"
"strings"
"testing"
"time"
"github.com/smartcontractkit/chainlink/core/adapters"
"github.com/smartcontractkit/chainlink/core/assets"
"github.com/smartcontractkit/chainlink/core/internal/mock... |
183510db08f007abba3deefec16ab492cc5825a7 | 40c18862d3efc95522b64fd30ebc741e37363fa3 | thallescarvalh0/boss | /consts/consts.go | Go | go | 1,667 | permissive | package consts
import "path/filepath"
const FilePackage = "boss.json"
const FilePackageLock = "boss-lock.json"
const FileBplOrder = "bpl_order.txt"
const FileExtensionBpl = ".bpl"
const FileExtensionDcp = ".dcp"
const FileExtensionDpk = ".dpk"
const FilePackageLockOld = "boss.lock"
const FolderDependencies = "module... |
96ff71eb2cc43a55b0c4735e6a8378cad6932c47 | 6ea42e8f3a00f27c27048e74d52c230ae265aa11 | xiaojiahuo/go-generics-example | /foreach/main.go | Go | go | 345 | permissive | package main
import (
"fmt"
)
func eachFunc[T any](a []T, f func(T) bool) {
for _, e := range a {
if !f(e) {
break
}
}
}
func main() {
eachFunc([]int{1, 2, 3, 4, 5, 6}, func(v int) bool {
fmt.Println(v)
return v < 4
})
eachFunc([]string{"foo", "bar", "", "zoo"}, func(v string) bool {
fmt.Println(v... |
e1b70c69c37e98e76a358557406ebcffffa206fa | 1437559ee44700211796651cfe85a439ae1cb6a2 | ibraimgm/bfi | /interpreter/parser/commands_test.go | Go | go | 1,678 | permissive | package parser_test
import (
"testing"
"github.com/ibraimgm/bfi/interpreter/parser"
"github.com/ibraimgm/bfi/interpreter/token"
)
func TestExtractCommand(t *testing.T) {
testCases := []struct {
value, command, quantity byte
}{
{value: 34, command: parser.CmdMoveRight, quantity: 34},
{value: 109, command: ... |
91bc0d3940e322671c8d70d56618f27cce694a40 | dfb8e816a9c2a2df23b3e56545806dd7d0961752 | mstrdiaz/ribbit-backend | /request/bank_account.go | Go | go | 1,382 | permissive | package request
import (
"net/http"
"strconv"
"github.com/alpacahq/ribbit-backend/apperr"
"github.com/gin-gonic/gin"
)
// Credentials stores the username and password provided in the request
type SetAccessToken struct {
PublicToken string `json:"public_token" binding:"required"`
AccountID string `json:"acco... |
165f865b59b2f880189e12a0daba28c704c9fbb3 | 5c9a7babb632d026fb41279fb89af1fd8b3dfdac | DenisDovmatov/login | /models/User.go | Go | go | 299 | no_license | package models
type User struct {
Id string
FirstName string
LastName string
Email string
Age string
Password []byte
}
func NewUser(id, firstname, lastname, email, age string, password []byte) *User {
return &User{id, firstname, lastname, email, age, password}
}
|
9708daaf60189c01da1049199bbcb33638229373 | 14c450c19c4c251c942573c31d64e59063989f1a | enixdark/epinio | /internal/application/application.go | Go | go | 6,567 | permissive | // Package application has actor functions that deal with application workloads
// on k8s
package application
import (
"context"
"fmt"
"regexp"
"sync"
"github.com/epinio/epinio/deployments"
"github.com/epinio/epinio/helpers/kubernetes"
"github.com/epinio/epinio/helpers/kubernetes/tailer"
"github.com/epinio/ep... |
a0e91b6106e968510e684ef4e938deeafa52e671 | c20e331f857598e83ab8bbee6c20aa9b09432bac | brzyangg/roc | /util/service/service.go | Go | go | 17,620 | permissive | // Copyright 2014 The roc Author. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rocserv
import (
"context"
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"gitlab.pri.ibanyu.com/middleware/se... |
d94407ce0ccd810273a37ea983a087516c76b70a | a14c7b6e58936505c6078120ad29d270209576c3 | comtjz/Pikachu | /src/logClient/createLogUploader.go | Go | go | 3,921 | no_license | package main
import (
"sync"
"log"
"config"
"tools"
"github.com/fsnotify"
"time"
)
type filenotifyLogUploader struct {
task string
cfg *config.CliJsonConfig
uploader *uploader
fileWatcher *tools.FileWatcher
wg sync.WaitGroup
// create file
fileCreateEvent chan string
// write file
fileWr... |
14bc509d9e2a7aca486f3ac86ecfacdd4985df77 | dfd7f977a6932589143e18a429e729c7e05c5bd9 | vtsingaras/go-smpp | /smpp/transmitter.go | Go | go | 15,836 | permissive | // Copyright 2015 go-smpp 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 smpp
import (
"crypto/tls"
"encoding/binary"
"errors"
"fmt"
"math/rand"
"strconv"
"sync"
"sync/atomic"
"time"
"github.com/veoo/go-smpp/smpp... |
6388c8fa0b60db02a9bfc91b0404ade51d04106f | 3fef3475fa4c5a4ce698d41c9eef92725c95f37f | launchpadcentral/mongo-go-driver | /x/mongo/driver/uuid/uuid.go | Go | go | 883 | permissive | // Copyright (C) MongoDB, Inc. 2017-present.
//
// 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
package uuid // import "github.com/launchpadcentra... |
930fdaa5d67206a71bc98addd714a74faad97978 | f95d662f903e1744ef968bfe99c383318ce00f57 | adeelahmad/okteto | /pkg/model/serializer.go | Go | go | 19,091 | permissive | // Copyright 2021 The Okteto 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 ... |
8314bf9cb00bf130ea4049b3eaa2879642da1fb0 | f7b4f8e60cc40e2232af90a2e96614d79e1769d6 | dgolovin/odo | /pkg/devfile/image/image.go | Go | go | 2,887 | permissive | // image package provides functions to work with Components of type Image declared in the devfile
package image
import (
"errors"
"os"
"os/exec"
devfile "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/library/pkg/devfile/parser"
"github.com/devfile/library/pkg/devfile/parser/data/v2... |
7c420964f4f79a1ada9410102a116c3555e3a7ae | d92063bade025201ca364d83b43272b7a9ed1c99 | keremceliker/docker-ovs | /vendor/src/github.com/docker/libcontainer/cgroups/fs/notify_linux.go | Go | go | 1,605 | permissive | // +build linux
package fs
import (
"fmt"
"os"
"path/filepath"
"syscall"
"github.com/docker/libcontainer/cgroups"
)
// NotifyOnOOM sends signals on the returned channel when the cgroup reaches
// its memory limit. The channel is closed when the cgroup is removed.
func NotifyOnOOM(c *cgroups.Cgroup) (<-chan str... |
d8073f4f00dade67b6625e6893f34e09ecd11f72 | 67296de3f4571bbcf86619f0af644af881ea98c4 | jdcloud-api/jdcloud-sdk-go | /services/ipanti/models/IpBwListSpec.go | Go | go | 882 | permissive | // Copyright 2018 JDCLOUD.COM
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
e6148f8dcacabf21c71563cd34c007450a701792 | f0a06fdac9df4180b6d3aa7bdb4a67c203f5cb2b | rakyll/gcping | /inputoutput.go | Go | go | 1,997 | permissive | // Copyright 2019 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... |
5d81f8d5c5ecf430a9948f0af88aa07f2aa993f3 | 1bc6c5a79f250eb370deb412d6fc601f2548942e | helloluluhan/fabric1 | /vendor/github.com/hyperledger/fabric-sdk-go/pkg/fab/events/deliverclient/opts.go | Go | go | 2,105 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package deliverclient
import (
"time"
"github.com/hyperledger/fabric-sdk-go/pkg/common/options"
"github.com/hyperledger/fabric-sdk-go/pkg/fab/events/api"
"github.com/hyperledger/fabric-sdk-go/pkg/fab/events/deli... |
737d3fd3f3f2666cb6ab1ad7ee301d146507f0da | e4548e7eda99eb89f37fc065c5e1963921222d10 | fanky5g/deadline | /util.go | Go | go | 805 | permissive | package deadline
import (
"crypto/tls"
"net"
"net/http"
"time"
)
var (
client *http.Client
)
// IsUnixTimePast compares current time vs passed in reference time to see if time is past
func IsUnixTimePast(refTime int64) bool {
return refTime-time.Now().Unix() <= 0
}
// GetClient returns an http client for tran... |
1dc8e451f321ae356a2bcbd7d97726e4dc37aed3 | 2796bc843f9cfd9cced86d43464eadb6d0340096 | fenggolang/go-nmea | /mda.go | Go | go | 4,093 | permissive | package nmea
/**
$WIMDA
NMEA 0183 standard Meteorological Composite.
Syntax
$WIMDA,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,
<12>,<13>,<14>,<15>,<16>,<17>,<18>,<19>,<20>*hh
<CR><LF>
Fields
<1> Barometric pressure, inches of mercury, to the nearest 0.01 inch
<2> I = inches of mercury
<3> Barometric pressure, ba... |
765deeb527ac3593c5208303d001a2329ba9fa37 | 0d20a0eb2d14479ca0cce016c33b578bf1fa2bc6 | dfengwji/pss.common | /proxy/department.go | Go | go | 4,441 | no_license | package proxy
import (
"context"
"errors"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"time"
)
type Department struct {
UID primitive.ObjectID `bson:"_id"`
ID uint64 `json:"id" bson:"id"`
Name string `json:"name" bson:"name"`
... |
6b4e6e40529d1529c7b7a5321d129c245a510b7d | 5b298054595c7a72a6af1fdbb4c713983285cd6b | reiver/go-utf8n | /decode_rune_ps_test.go | Go | go | 4,595 | permissive | package utf8n
import (
"unicode/utf8"
"testing"
)
func TestDecodeRunePS(t *testing.T) {
tests := []struct{
Bytes []byte
ExpectedRune rune
ExpectedSize int
}{
{
Bytes: []byte("apple"),
ExpectedRune: 'a',
ExpectedSize: utf8.RuneLen('a'),
},
{
Bytes: []byte("BANANA"),
ExpectedRune: 'B',
... |
105ec773a006e1d0d40ad690e5e62d8baebded37 | 2eb7c4d0d4815493457a83690c42c3219346ec95 | cloudboss/unobin | /vendor/github.com/awslabs/goformation/v5/cloudformation/route53recoverycontrol/aws-route53recoverycontrol-routingcontrol.go | Go | go | 4,688 | permissive | package route53recoverycontrol
import (
"bytes"
"encoding/json"
"fmt"
"github.com/awslabs/goformation/v5/cloudformation/policies"
)
// RoutingControl AWS CloudFormation Resource (AWS::Route53RecoveryControl::RoutingControl)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route5... |
4e4bb7cc94f78dabcb681a4a9880f40fb2a74838 | 1c499f2ba50c67770e0049ace2f58b0d155d2ee8 | mailund/learn-go | /src/tempconv/tempconv.go | Go | go | 557 | no_license | // Package tempconv converts between Celsius and Farenheit
package tempconv
import "fmt"
// Celsius Temperature scale
type Celsius float64
// Farenheit Temperature scale
type Farenheit float64
const (
// AbsoluteZeroC Absolute zero temperature in Celsius
AbsoluteZeroC Celsius = -273.15
// FreezingC Freezing poin... |
ac29e22ded1358ecf73db0d570e13015698ecf9a | b929f02610f744e3c5a352a6fbf91926f9d351d3 | CapstoneBlockchain/diamond-blockchain | /diamond-chaincode/test/DiamondChaincode.go | Go | go | 11,622 | permissive | package main
import (
"fmt"
"time"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
"strconv"
"encoding/json"
)
// Diamond implements a simple chaincode to manage an asset
type DiamondChaincode struct {}
type UserInfo struct {
Name string `json:"userName"`
... |
36ad3f79906efe4ed1cdddfd748586adae7e21d4 | 3352d74595962c46ee9c63b011a9d9ab115c46cd | keltia/erc-search | /people.go | Go | go | 979 | no_license | package main
import (
"github.com/pkg/errors"
)
// searchForPeople looks into the corporate LDAP
func searchForPeople(text string) error {
// Do the actual connect
src := NewSource("corporate")
verbose("Source: %v CNF: %v", src, ctx.cnf)
server, err := NewServer(&Source{
Domain: src.Domain,
Site: src.Site,... |
53cc56b447a560567153efe9e9ac61dae49fbf8e | 24431571856f0499590ea601aa9391ab8989cf81 | adelyn123/chainlink | /core/store/orm/schema.go | Go | go | 4,683 | permissive | package orm
import (
"log"
"math/big"
"net/url"
"reflect"
"time"
"chainlink/core/assets"
"github.com/ethereum/go-ethereum/common"
)
// ConfigSchema records the schema of configuration at the type level
type ConfigSchema struct {
AllowOrigins string `env:"ALLOW_ORIGINS" default:"http://l... |
1e5cd70c2d87f2b6cffe540a2c7797faa02b64de | 6a8f888fd588d48c4806077f2f449e12f5bae609 | vladsolomko/okteto | /pkg/model/dev_test.go | Go | go | 15,487 | permissive | // Copyright 2020 The Okteto 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 ... |
c1e67edae413349bbc1f016e392a08e8a0104090 | 599a544ea32c28890c3275f8b6ee4816cd1aeb29 | hashgard/cosmos-sdk | /x/auth/signing/sig_verifiable_tx.go | Go | go | 717 | permissive | package signing
import (
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/tendermint/tendermint/crypto"
)
// SigVerifiableTx defines a Tx interface for all signature verification decorators
type SigVerifiableTx interface {
types.Tx
GetSigners() []types.AccAddress
... |
94cad7f6534b71ca20f59127a8bf545c53fbfb59 | bd4d9889d2124669f33f192ff3944780034bd050 | vodolaz095/telegraf | /plugins/inputs/aerospike/aerospike.go | Go | go | 3,438 | permissive | package aerospike
import (
"errors"
"log"
"net"
"strconv"
"strings"
"sync"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
as "github.com/aerospike/aerospike-client-go"
)
type Aerospike struct {
Servers []string
}
var sampleConfig = `
## Aerospike servers to con... |
9c48790d052e8b7ab9418e5aeabe522a5ba06ef2 | d937b4a4a87e368539d5256e1c227c250ffcdaef | ShuheiIshihara/MaterialManager | /controllers/biz/register.go | Go | go | 4,134 | no_license | package biz
import (
"fmt"
"log"
"strconv"
"encoding/json"
// "bytes"
"MaterialManager/models/db"
)
// 登録データ一覧
const (
ID = "dataID" // データID
Level = "level" // 提督レベル
Fuel = "fuel" // 燃料
Ammun = "ammunition" // 弾薬
Steel = "steel" //... |
4265672cc5551e1400e917e3f4b2e8fac3364d91 | f869549cfe5465c4573b6c3b9bb8644e4febee85 | graphlog/heimdall | /pkg/services/db.go | Go | go | 338 | no_license | package services
import (
"log"
_ "github.com/ClickHouse/clickhouse-go"
"github.com/graphlog/heimdall/pkg/config"
"github.com/jmoiron/sqlx"
)
func NewDBConnection(c *config.Config) *sqlx.DB {
connect, err := sqlx.Open("clickhouse", c.DataStores.ClickHouseURI)
if err != nil {
log.Fatal(err)
return nil
}
... |
3707eb5fecd359b7205bada861240396606b5e76 | 8c9d7906700aee6bdcc0166b3d25d07b498d7e1d | nils-getdreams/terraform-provider | /provider.go | Go | go | 931 | no_license | package main
import (
"github.com/84codes/go-api/api"
"github.com/hashicorp/terraform/helper/schema"
)
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"apikey": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.Env... |
5fddaaecd68d75e8fe5eba67c1591174ce684fc3 | 99a43788b79f0952b31e748b51de40b9cfcb9320 | BenGab/go-concurrency.sandbox | /main.go | Go | go | 1,066 | no_license | package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
var cache = map[int]Book{}
var rnd = rand.New(rand.NewSource(time.Now().UnixNano()))
func main() {
wg := &sync.WaitGroup{}
cacheCh := make(chan Book)
dbCh := make(chan Book)
for i := 0; i < 10; i++ {
id := rnd.Intn(10) + 1
wg.Add(2)
go func(id in... |
8c317ca342d10f67778755406d98a502d91d5b7b | 3584c971dfbee8fff1f1253220ee05373471e022 | afif0808/barcodeMaker | /services/MakeBarcodeLabelImage.go | Go | go | 1,251 | no_license | package services
import (
"barcodeMaker/model"
"fmt"
"image"
)
func MakeBarcodeLabelImage(
imageSetting model.ImageSettings,
barcodeLabelSettings model.BarcodeLabelSettings,
barcodeLabelPosition model.BarcodeLabelPositions,
makeTextImage model.MakeTextImage,
makeBarcodeImage model.MakeBarcodeImage,
arrangeIm... |
4c75370da747281f0974770172ad5d170598ffe1 | ca97883179db464d634c15ce06ca69f4daba3ad1 | varluffy/gindemo | /internal/app/initialize/http.go | Go | go | 871 | permissive | package initialize
import (
"context"
"fmt"
"github.com/spf13/viper"
"github.com/varluffy/gindemo/pkg/logger"
"net/http"
"time"
)
// InitHTTPServer 初始化HTTP服务
func InitHTTPServer(ctx context.Context, handler http.Handler) func() {
addr := fmt.Sprintf("%s:%d",
viper.GetString("HTTP.Host"),
viper.GetInt("HTTP... |
7321ccc9ee13371fc8129b236494057fda1eb0fd | 016fda4e400585d6d973c5bd4c06817f7956d5dd | Doslin/go-streams | /flow/pass_through.go | Go | go | 1,244 | permissive | package flow
import (
"github.com/reugn/go-streams"
)
// PassThrough produces the received element as is.
//
// in -- 1 -- 2 ---- 3 -- 4 ------ 5 --
// | | | | |
// out -- 1 -- 2 ---- 3 -- 4 ------ 5 --
type PassThrough struct {
in chan interface{}
out chan interface{}
}
// NewPassThrou... |
b5d6d260af21d3de6a4325d4838a0c872245bc88 | cc6267f2817587a3ea3cf3aaab4cf2bbdab3f56a | AdedayoMj/Piscine_Golang-Task | /Codes/printcombn.go | Go | go | 604 | no_license | package piscine
import "github.com/01-edu/z01"
func PrintCombN(n int) {
var num [9]rune
var i int
var counter int
if n > 9 {
n = 9
}
if n == 0 {
z01.PrintRune('\n')
return
}
for i = 0; i < n; i++ {
num[i] = rune(i + 48)
}
for {
for i = 0; i < n; i++ {
z01.PrintRune(num[i])
}
i = n - 1
for... |
4f963257653b4dd59f250d519a1c336b1c082cca | 6540129dbde349146c61ab32f8c54326dac6744e | Mikubill/transfer | /apis/image/juejin.go | Go | go | 1,115 | permissive | package image
import (
"encoding/json"
"fmt"
"regexp"
"strings"
)
var (
JJBackend = new(JJ)
)
type JJ struct {
picBed
}
type JJResp struct {
Code int `json:"s"`
D JJCol `json:"d"`
}
type JJCol struct {
URL JJItem `json:"url"`
}
type JJItem struct {
Http string `json:"http"`
Https string `json:"ht... |
58f8b27c642f9222d9a70fa085d58e7dcead0ac8 | c91ab79bde74b9fe763b2306bee297c4e7cc3d8b | ev2li/go-study | /basedata/ref/main.go | Go | go | 240 | no_license | package main
import "fmt"
func modify(a int){
a = 10
return
}
func modify1(a *int) {
b := 10
*a = b
}
func main() {
var a = 100
var b = make(chan int, 1)
fmt.Println("a=", a)
fmt.Println("b=", b)
modify1(&a)
fmt.Println(a)
}
|
b9a7267fdb958f3dfb5bc9de4d40b91abc7ed3ae | 3911251c7ab83926435782ed06952c1a2357bf1e | andrewtremblay/GoAuth | /tools/redis/redis.go | Go | go | 778 | no_license | package redis
import (
"fmt"
redigo "github.com/garyburd/redigo/redis"
"time"
)
const (
redisPort string = "127.0.0.1:6379"
//redisPassword string = ""
)
var (
con *redigo.Pool
)
func newPool() *redigo.Pool {
return &redigo.Pool{
MaxIdle: 3,
IdleTimeout: 240 * time.Second,
Dial: func() (redigo.Conn... |
8c26cf67f904a0c5d4f2493a2c6a499a09de8876 | 9472970f5aabd3ccc014050e222ea130c083efdc | DataDog/datadog-agent | /pkg/ebpf/bytecode/runtime/integrity.go | Go | go | 3,783 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
//go:build ignore
package main
import (
"crypto/sha256"
"fmt"
"io"
... |
3ce619bbb850c4b86cb5306d93c97d490b5a8604 | 13ca5162ee4ee773a67f9a4e6b533eb06815c769 | grebnetiew/directorylist | /filesys.go | Go | go | 1,928 | no_license | package main
import (
"fmt"
"log"
"os"
"sort"
"strings"
)
type FileList []os.FileInfo
const slash = string(os.PathSeparator)
func main() {
// The only means of input is using command line arguments.
// Produce an error if no suitable command line is given.
if len(os.Args) < 2 {
log.Fatalf("Usage: %s <dire... |
b057fc5db4e9e1b2d8047cebfae002a3d6d35ea9 | 60a75fc5a06dcc6737667f2e5ad7c06cd530a066 | rezamirz/myalgos | /graph/graph.go | Go | go | 2,436 | permissive | /*
graph.go
MIT License
Copyright (c) 2018 rezamirz
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, pub... |
083aceb08e8b9a0644b0bd68bd445672e0bc00a3 | f58ddb08936707ad587922c4dad67e211c6f4a8b | hindhelpcare/ledger | /cmd/lweb/handler_accounts.go | Go | go | 7,632 | permissive | package main
import (
"bytes"
"fmt"
"html/template"
"io"
"math/big"
"net/http"
"os"
"strings"
"time"
"github.com/howeyc/ledger"
"github.com/go-martini/martini"
"github.com/pelletier/go-toml"
)
type quickviewAccountConfig struct {
Name string
ShortName string `toml:"short_name"`
}
type quickviewC... |
d65619440b46e3661d5d099b6d4011c6e08d4486 | 16703b390c769dc1049fc7b3ccf96755f3ef675f | imattf/gowebdev | /015-tcp-servers/01-write/bufio/03-scan-characters/main.go | Go | go | 462 | no_license | //scan a string type variable for tokens line and split by chars
//tokens by default are lines
package main
import (
"bufio"
"fmt"
"strings"
)
func main() {
s := "I felt so good like anything was possible\n I hit cruise control and rubbed my eyes\n"
scanner := bufio.NewScanner(strings.NewReader(s))
//runes =... |
a54a756fce397da6d84a0e9f36562f51dd5681c4 | 67e5fb8294b3c69a8925ea3120bd8f7f75e0662d | Archieeeeee/aiocrossgo | /data/aiodata.go | Go | go | 10,813 | no_license | package data
import (
"fmt"
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/canvas"
"fyne.io/fyne/theme"
"fyne.io/fyne/widget"
"github.com/go-resty/resty/v2"
"github.com/json-iterator/go"
"github.com/mitchellh/go-ps"
"image/color"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
"str... |
4cd72cb1b55ede78a00ee6d0ae4bc16685080f4a | cad95fb3d1f9ec10433fbbfe3b161162780edf27 | oars-sigs/oars-cloud | /core/ingress.go | Go | go | 3,228 | no_license | package core
import (
"encoding/json"
)
//IngressListener 入口 Listener
type IngressListener struct {
*ResourceMeta
Port int `json:"port"`
TLSCerts []TLSCertificate `json:"tlsCerts,omitempty"`
DisabledTLS bool `json:"disabledTLS"`
Drive string `json:"drive,omitem... |
862d304655e1298a90a2af84b4d19d3bdcde6f8f | 806a65c9f094e34f8629356a03fe300a694d8c37 | shinomontaz/chupdate | /tests/testing/main.go | Go | go | 2,029 | permissive | package main
import (
"errors"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"strings"
"sync"
"time"
)
var client *http.Client
var chUrl string
var wg sync.WaitGroup
func main() {
// создаем сервер, который слушает POST-сообщения и пробрасывает их на http-ручку CH и возвращает ответ.
in := make(chan string, 10... |
0059af1a712d094d9eab5156fe89c7f5070fdadc | cd1ca2f5b1e34a2893a23359e9625b8f8c0b3d4a | Azure/application-gateway-kubernetes-ingress | /pkg/apis/azureapplicationgatewayrewrite/v1beta1/types.go | Go | go | 4,379 | permissive | // -------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// -----------------------------------------------------------------... |
482c9897b1e62c510434ab4b1bfa8bee7a84c1fa | e7afcc5dfed906dc89650b3dbc6306e7d0e54ce0 | iamgafurov/bank | /pkg/types/types.go | Go | go | 781 | no_license | package types
type Money int64
type Currency string
//Currency typesss
const (
TJS Currency = "TJS"
RUB Currency = "RUB"
USD Currency = "USD"
)
//Payment Status types
const (
StatusOk Status = "OK"
StatusFail Status = "FAIL"
StatusInProgress Status = "INPROGRESS"
)
type PAN string
type Card st... |
b07366d0a8c1fbf5380b1116eda89eb24727b0e1 | a7b48194348696526146007badec47070f087c1e | SenCoder/prom-exporter | /postgres_exporter/pg_setting.go | Go | go | 3,498 | no_license | package main
import (
"fmt"
"math"
"strconv"
"strings"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
)
// Query the pg_settings view containing runtime variables
func querySettings(ch chan<- prometheus.Metric, server *Server) error {
log.Debugf("Querying pg_setting view o... |
f28495936e71c3e097886ed30960fc4a132bd8e5 | 49494204b96d5a96b8da22da53d1a8fc23db4322 | Juminiy/my_go_lib | /my_algo/algo_compile/finite_automata/fa_algo.go | Go | go | 5,422 | permissive | package finite_automata
import (
ds "github.com/Juminiy/my_go_lib/my_algo/algo_base/data_struct/complicated"
"github.com/Juminiy/my_go_lib/my_algo/algo_base/data_struct/simple"
"github.com/Juminiy/my_go_lib/my_algo/algo_compile/input_struct"
)
// 多线程环境线程常量不可用
const (
epsilon = "epsilon"
charQ = 'q'
... |
02d29910708f32f51dd1551897362571a65f7302 | 42ca9c170c4b469c78d8108e1e74479b5ffbd550 | andycai/void | /codec/msgpack/msgpack.go | Go | go | 618 | permissive | package msgpack
import (
"github.com/andycai/void/codec"
"github.com/vmihailenco/msgpack/v5"
)
type MsgpackCodec struct {
}
func (m *MsgpackCodec) Name() string {
return "msgpack"
}
func (m *MsgpackCodec) MimeType() string {
return "application/msgpack"
}
func (m *MsgpackCodec) Marshal(v interface{}) ([]byte, ... |
514931e0a9c819ed5436b34099be143875d93a20 | ad6a07b3909f731838a54bdefd91eadee425d3bf | CharlyF/custom-metrics-apiserver | /vendor/golang.org/x/net/http2/server_test.go | Go | go | 109,788 | permissive | // Copyright 2014 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 http2
import (
"bytes"
"context"
"crypto/tls"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/httptest"
"os"
"os/... |
288902a76dd81790734614c7058e29810a107978 | cc0ac9a086c605317423c44b54a47c7e032f9f97 | GarbledWang/GoAes | /main.go | Go | go | 1,525 | no_license | package main
import (
"flag"
"fmt"
"os"
"bufio"
"io"
"encoding/base64"
)
func main() {
var password string
var filePath string
var aesType int
flag.StringVar(&password, "password", "", "Your Password")
flag.StringVar(&filePath, "filePath", "", "File Absolute Path")
flag.IntVar(&aesType, "type", 0, "Enrypt... |
8c57ff16c84a568b892a1de18a20eba7eede8ade | 115faf55b37d6fbd93715946f842be0b31296b0b | knative/eventing | /pkg/apis/eventing/v1beta2/doc.go | Go | go | 698 | permissive | /*
Copyright 2021 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, softwar... |
dfcce7e6c6ebaa43401efb4ab3158465a76658cd | d2fc9f5b6d1e1f07dc2329cf529e9a3bf350898d | json7/expr | /vm/program_test.go | Go | go | 382 | permissive | package vm_test
import (
"github.com/antonmedv/expr/vm"
"strings"
"testing"
)
func TestProgram_Disassemble(t *testing.T) {
for op := vm.OpPush; op < vm.OpLoad; op++ {
program := vm.Program{
Constants: []interface{}{true},
Bytecode: []byte{op},
}
d := program.Disassemble()
if strings.Contains(d, "\t... |
1f066646973e2b070c3a00a78712b92fcd77969f | d6e6b4c152aaec632f7fc9ffadee10b2770b2e40 | raxetul/hazelcast-go-client | /internal/listener.go | Go | go | 14,224 | permissive | // Copyright (c) 2008-2017, 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... |
2009c9ea5307f484de9368abf97f1aef325efbb2 | 3261405cc27a52ec7f216ecbc05a9bd22662adad | UTMIST/MISTR | /gitlab/gitlab.go | Go | go | 4,136 | no_license | package gitlab
import (
"bufio"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"strconv"
"strings"
goGitLab "github.com/xanzy/go-gitlab"
)
const gitlabTokenEnv = "GITLAB_TOKEN"
const jobIDFile = "jobs.txt"
const projIDEnv = "PROJECT_ID"
const websitePipelinesBase = "https://gitlab.com/utmist/utmist.gitlab.io/pipeli... |
0a79f5d57e037deef94198667ca2ea8d415d9860 | 819f2d82baa69dd17df67869defba828028f4ecd | jywei/GoTraining | /23_error-handling/02_err-not-nil/05_panic/main.go | Go | go | 269 | no_license | package main
import (
"os"
)
func main() {
_, err := os.Open("no-file.txt")
if err != nil {
// fmt.Println("err happened", err)
// log.Println("err happened", err)
// log.Fatalln(err)
panic(err) // exit status 2, panic and recover == try and catch
}
}
|
3d5fa10831245db481442554a477b9cfc694fedd | fe830336862501fe6188ad874c59616fab9da7c8 | replicatedhq/troubleshoot | /internal/specs/secrets_test.go | Go | go | 12,965 | permissive | package specs
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
testclient "k8s.io/client-go/kubernetes/fake"
)
func Test_LoadFromSecretMatchingLabel(t *testing.T) {
tests := []stru... |
1a0b96c6ccba9097105336c598e2ed4d21e14d16 | 0147a16890338d83a05f1c5ecf73e9141277a185 | Qingluan/AllScannerInThis | /main.go | Go | go | 1,415 | no_license | package main
import (
"flag"
"log"
"github.com/Qingluan/AllScannerInThis/admin"
"github.com/Qingluan/AllScannerInThis/banner"
"github.com/Qingluan/AllScannerInThis/common"
"github.com/Qingluan/AllScannerInThis/dir"
"github.com/Qingluan/jupyter/http"
"github.com/Qingluan/merkur"
)
var (
ScanClass = ""
Targe... |
ad266b1816ffdb4ad61eeb87e140b5faed278009 | b31ff255bfacb941000de84dd565c56aea260af0 | thatguynikita/learn-go-with-tests | /mocking/countdown_test.go | Go | go | 1,516 | no_license | package main
import (
"bytes"
"reflect"
"testing"
"time"
)
const (
sleep = "sleep"
write = "write"
)
type CountdownOperationSpy struct {
Calls []string
}
func (c *CountdownOperationSpy) Sleep() {
c.Calls = append(c.Calls, sleep)
}
func (c *CountdownOperationSpy) Write(p []byte) (n int, err error) {
c.Call... |
4047450a475a6f67e9f2f7d52e7ca48111d1b622 | 72ac090814595f65b9a9fac3fdc73ae10585d88b | OlessyaG/Goland-hw3 | /hw3.go | Go | go | 299 | no_license | package main
import "fmt"
func main() {
a:=9.0
b:=8.0
c:=7.0
d:=6.3
e:=-1
fmt.Println(a+b+c)
fmt.Println(a*b*c)
fmt.Println(b+c+d)
fmt.Println(b*c*d)
fmt.Println(a/b)
fmt.Println(int(a)%int(b))
fmt.Println(int(a)/e)
fmt.Println((int(a)*int(a)+int(b)*int(b))-(int(c)^2-int(d)^2))
}
|
8576904cd1f4b0ea2d8011a2c0e77d6bfcb8a0f0 | f1d45c256be98182711b93c4ada128e4179b2ed2 | davidlanouette/etcd | /contrib/raftexample/raft_test.go | Go | go | 2,908 | permissive | // Copyright 2022 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
f7a534905433d7c97f20d496548dc300100a951e | 770334e7be86314fbd8cd81b724db1015f0d4bcc | shiftstack/cluster-api | /controllers/topology/internal/scope/upgradetracker.go | Go | go | 1,683 | permissive | /*
Copyright 2021 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, ... |
4f73770478b7085dd8da72e6f6faa7314796ded6 | ca565b9addb3dc6c8600c29e2d8fcd80b80a13a1 | jaychouwii/cke | /images.go | Go | go | 798 | permissive | package cke
// Image is the type of container images.
type Image string
// Name returns docker image name.
func (i Image) Name() string {
return string(i)
}
// Container image definitions
const (
EtcdImage = Image("quay.io/cybozu/etcd:3.3.25.3")
KubernetesImage = Image("quay.io/cybozu/kubernetes:1.19.7.2")
... |
e2e0394c0e56d9c329b3d7f73f2252912069f84a | 033b2d8ea9d012b2d65c94a990fc73a522833d3a | CoachApplication/command | /provider/get.go | Go | go | 1,599 | no_license | package provider
import (
"github.com/CoachApplication/api"
"github.com/CoachApplication/base"
base_errors "github.com/CoachApplication/base/errors"
"github.com/CoachApplication/command"
)
type GetOperation struct {
command.GetOperation
provider Provider
}
func NewGetOperation(prov Provider) *GetOperation {
... |
94511fa2bada7cf8f75e9a4022405e9d16f9d50d | f39484a92fd8c08b3cc00e6eaf5ce3f6a751ca1f | decred/dcrlnd | /subrpcserver_config.go | Go | go | 10,995 | permissive | package dcrlnd
import (
"fmt"
"reflect"
"github.com/decred/dcrd/chaincfg/v3"
"github.com/decred/dcrlnd/autopilot"
"github.com/decred/dcrlnd/chainreg"
"github.com/decred/dcrlnd/channeldb"
"github.com/decred/dcrlnd/htlcswitch"
"github.com/decred/dcrlnd/invoices"
"github.com/decred/dcrlnd/lncfg"
"github.com/de... |
b1b3833323074735aee059d837f908936e182651 | 450edd0034cd60f38b616dba209e3d9458fe1d38 | Napat/jogolang | /go-routine/02_race-condition_mutex_atomicity/main.go | Go | go | 947 | no_license | /*
- Race-condition checking
+ go run -race main.go
- mutex (My preferred)
- atomicity
+ import("sync/atomic")
*/
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
var wg sync.WaitGroup
var counter int64 //global share variable
var mutex sync.Mutex
func main() {
wg.Add(2)
go incrementor("Foo:")
go inc... |
1b8cc2ef38988df6064a9284d2ea60bce5754c34 | 92b609c3cb84f86be867e7c55fd7ba5eb765517e | MaxymVlasov/gvisor | /runsc/cmd/delete.go | Go | go | 2,527 | permissive | // Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
6ab8cf989d5b099c3c20843cafef54f562cc68a0 | ac0f54f44cff59974a036cfc5488f7488d3a5360 | ht-dep/engineercms | /controllers/attachment.go | Go | go | 47,302 | permissive | //成果里的附件操作
package controllers
import (
// "code.google.com/p/mahonia"
"encoding/json"
"github.com/3xxx/engineercms/controllers/utils"
"github.com/3xxx/engineercms/models"
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
"github.com/astaxie/beego/httplib"
// "github.com/astaxie/beego/logs"
"net/h... |
ad005191aad9540038133b49de93578b292e44dd | 115ad52bcf61192a72e997d6eb9e713715af2d71 | kdada/ingress | /controllers/gce/backends/backends.go | Go | go | 11,685 | 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, ... |
5814df15f89fce1a16fc0d7a780b59791e4f3b3b | fd3e488100feda759f3b9f54a0f67c995ecbbbd0 | SalmonMode/ygor | /ygord/module_commands_test.go | Go | go | 563 | permissive | // Copyright 2015, Truveris Inc. All Rights Reserved.
// Use of this source code is governed by the ISC license in the LICENSE file.
package main
import (
"testing"
)
func TestModuleCommands(t *testing.T) {
srv := CreateTestServerWithTwoMinions(t)
(&NopModule{}).Init(srv)
m := &CommandsModule{}
m.Init(srv)
m... |
4e0f6d228d15a6198d46062c5566c992093be715 | 0bca707eee0d9a0e98df0dba1176eab6dc6cdc03 | gitter-badger/go-proxy-2 | /common/config_test.go | Go | go | 2,590 | no_license | package common
import (
"encoding/json"
"io/ioutil"
"os"
"testing"
)
const (
configPath = "server.conf"
)
func clearConfigFile() {
os.Remove(configPath)
}
func TestConfigSaveConfig(t *testing.T) {
clearConfigFile()
config := Config{
ListenAddr: ":7474",
RemoteAddr: "do.wuhaolin.cn:45234",
Password: ... |
8abcb3e7815d6fa0f31948d38be32ab04690b483 | 55ff7bd5feb7ca6a7b3c6d2313b119b2df2cbafc | OpenSlides/openslides-autoupdate-service | /internal/restrict/perm/generate/main.go | Go | go | 3,121 | permissive | package main
import (
"bytes"
"fmt"
"go/format"
"io"
"log"
"net/http"
"os"
"sort"
"strings"
"text/template"
"github.com/OpenSlides/openslides-autoupdate-service/internal/models"
"gopkg.in/yaml.v3"
)
func main() {
if err := run(); err != nil {
log.Fatalf("Error: %v", err)
}
}
func run() error {
f, e... |
e8eed0ca89b416bc78f49c5b79aa7af300370219 | a1985ae03e56c699903ea236b262a5bf49e8b182 | rgarcia/mgotest | /rs.go | Go | go | 3,286 | permissive | package mgotest
import (
"sync"
"time"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
)
const (
statePrimary = 1
stateSecondary = 2
)
type configMember struct {
ID int `bson:"_id"`
Host string `bson:"host"`
}
type config struct {
ID string `bson:"_id"`
Version int `bson:"versio... |
20cc64a93dd5acef62df111144b53e44e2a33d66 | dcc50d62421f5b7ff4424c2a9b9e75f29f4e3c6f | yugabyte/gocql | /integration_test.go | Go | go | 6,904 | permissive | // +build all integration
package gocql
// This file groups integration tests where Cassandra has to be set up with some special integration variables
import (
"context"
"reflect"
"testing"
"time"
)
// TestAuthentication verifies that gocql will work with a host configured to only accept authenticated connection... |
070cfcb2253f8a1f0b620b0ad05baf3a216945eb | 11ef3936424129998dbb36850e2fbb593ce55d92 | sidmohanty11/learning-go | /Composite-Design/composite_geometry.go | Go | go | 1,192 | no_license | package composite
import (
"fmt"
"strings"
)
type GraphicObject struct {
Name, Color string
Children []GraphicObject // recursive relationship.
}
func (g *GraphicObject) String() string {
sb := strings.Builder{}
g.print(&sb, 0)
return sb.String()
}
func (g *GraphicObject) print(sb *strings.Builder, depth ... |
31187abced8ca816b2bfecff9754e5ac57a1c904 | 65436d5c4c690c866620f870bea7903515d5e272 | ktd131/ex2go | /request7.go | Go | go | 881 | no_license | package main
import (
"context"
"fmt"
"log"
"time"
)
func Run7() {
// 7. Tạo 1 đối tượng context với 1 value là timestamp hiện tại tính theo `ns`
// chạy qua 1 hàm như sau. Sau 3s in ra hiệu của thời gian của thời gian hiện
// tại với biến dữ liệu trong context. in ra màn hình kết quả.
// ```go
// func x(ct... |
f41861c701bfaee5f1122b7c3f86ccb10e36ae01 | d12707e5ed9720e1a2ff79b5b15fd8fa2722ac6e | marcomilon/ezphp | /main.go | Go | go | 1,562 | permissive | package main
import (
"flag"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"github.com/marcomilon/ezphp/internal/php"
)
const (
ezPHPWebsite = "https://github.com/marcomilon/ezphp"
downloadURL = "https://windows.php.net/downloads/releases/php-7.4.14-nts-Win32-vc15-x64.zip"
installFolder = "php-7.4.14"
)
f... |
d02605930b5fea0d45bc490f60a56ce2bf8f70e7 | 09eae436251fa58a70290406de363cae523eb8c7 | EternalZero/GoLangClass | /app/photos.go | Go | go | 1,069 | no_license | package mem
import (
"crypto/sha1"
"fmt"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
"io"
"mime/multipart"
"net/http"
)
func uploadPhoto(src multipart.File, id string, req *http.Request) error {
defer src.Close()
fName := getSha(src) + ".jpg"
return addPhoto(fName, id, req)
}
func addPhoto(fName ... |
047b996b5750284ad281af4ee1f5900a4eaec88b | 3f9d55c961d38959f11a9e2882ff2253cea8ec42 | sapcc/cyclone | /vendor/github.com/gophercloud/utils/openstack/blockstorage/extensions/backups/utils.go | Go | go | 1,225 | permissive | package backups
import (
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/backups"
)
// IDFromName is a convenience function that returns a backup's ID given its
// name. Errors when the number of items found is not one.
func IDFromName(client *gophercloud.S... |
51c33eeb2f9ab55b989eedc825e683aa921e5933 | 0ccdca372368bba0686fa77eea21a61544ac058b | grafana/cortex-tools | /vendor/github.com/google/go-github/v32/github/repos_comments.go | Go | go | 5,144 | permissive | // Copyright 2013 The go-github 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 github
import (
"context"
"fmt"
"time"
)
// RepositoryComment represents a comment for a commit, file, or line in a repository.
type Repo... |
8e9bc09ef5f2598c9bff7b9ab0bf4d9ca77a2700 | c8b99b6466c5a74eea0159d7dcf7afaf83f1a4ab | aribalam/go-watch | /cmd/api/middleware.go | Go | go | 259 | no_license | package main
import "net/http"
func (app *Application) enableCORS(next http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
rw.Header().Set("Access-Control-Allow-Origin", "*")
next.ServeHTTP(rw, r)
})
}
|
1eac3d2962b6d528e37666a446129da8f1da9267 | 53aa5967b8f202f8d4748269a378cf5bf3dd6353 | mandarjog/bots | /policybot/plugins/topics/pullrequests/topic.go | Go | go | 1,621 | permissive | // Copyright 2019 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
2fae1548b206916fd8db1700e8b008206dff9bdf | 1debf64bc0f679f07637a1351dd302d24aaebf18 | yusufyilmazfr/tasarim-desenleri-turkce-kaynak | /builder/go/new-student-lesson-builder.go | Go | go | 966 | no_license | package main
// newStudentLessonBuilder LessonBuilder sınıfından türer ve orada tanımlı adımları gerçekleştirir.
// UML diyagramındaki ConcreteBuilder sınıfına denk gelmektedir.
type newStudentLessonBuilder struct {
Lesson *lesson
}
func NewNewStudentLessonBuilder() *newStudentLessonBuilder {
return &newStudentLess... |
380355010d253f951c2f4325c059115915091ef6 | 1555189f05223b5d29d4986f11d08bfac924287d | trendever/services | /vendor/src/github.com/theplant/cldr/resources/locales/tzm/main.go | Go | go | 285 | no_license | package tzm
import "github.com/theplant/cldr"
var Locale = &cldr.Locale{
Locale: "tzm",
Number: cldr.Number{
Symbols: symbols,
Formats: formats,
Currencies: currencies,
},
Calendar: calendar,
PluralRule: pluralRule,
}
func init() {
cldr.RegisterLocale(Locale)
}
|
8c5637777d3c3b9fa996cc61d0f7784991f384e4 | bb7571d060594a8a6bd3960e64482b45282615ba | ccojocar/jx | /pkg/cloud/amazon/ecr.go | Go | go | 4,168 | permissive | package amazon
import (
"fmt"
"regexp"
"strings"
"github.com/jenkins-x/jx/v2/pkg/cloud/amazon/session"
"github.com/jenkins-x/jx/v2/pkg/kube"
"k8s.io/client-go/kubernetes"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/ecr"
"github.com/aws/aws-sdk-... |
38f8f3472b4f1d3b08ffba270e47b8b818299979 | f2e8cd342716150ef821e3a63d36fedd662ff970 | mechmind/git-go | /rawgit/tag.go | Go | go | 1,525 | no_license | package rawgit
import (
"io"
"io/ioutil"
)
type Tag struct {
OID
OType
TargetOID OID
TargetOType OType
Name string
Tagger UserTime
Message string
}
func ReadTag(obj io.ReadCloser) (*Tag, error) {
var tag = new(Tag)
var infobuf = make([]byte, 1024)
tag.OType = OTypeTag
defer obj.Close... |
931dd7d674afe543be6d2da981c55ffc33c956cc | a35c0928a7d504e10c4acfa5f096f568177000e7 | GuruVamsiKrishna/2020-12-UNISYS-GOLANG | /e07/switch.go | Go | go | 351 | no_license | package main
import "fmt"
func main() {
var month int
fmt.Print("Enter value for a month (1-12): ")
fmt.Scanf("%d", &month)
switch month {
case 2:
fmt.Println("28 or 29 days")
case 4, 6, 9, 11:
fmt.Println("30 days")
case 1, 3, 5, 7, 8, 10, 12:
fmt.Println("31 days")
default:
fmt.Println("Invalid va... |
0cd31c9c85b4522cc89bf6ee1ac68db5d0a4b21e | afd7f97f67158dda33e2eb859669208518680475 | bernmic/go2music | /database/album_test.go | Go | go | 3,353 | permissive | package database
import (
"go2music/model"
"testing"
)
func Test_InitializeAlbum(t *testing.T) {
if !chechTableExists("album") {
t.Fatalf("Table album not created\n")
}
}
func Test_CRUD_Album(t *testing.T) {
album := model.Album{Title: "Testalbum", Path: "/some/where"}
savedAlbum, err := testDatabase.CreateA... |
de34d5d9c1c5f83ac7a2570010b11f098dee9dfc | a19bad9c5e9fdf5235d2a49aee1ed2b3b8b7c409 | naiba/solitudes | /router/media.go | Go | go | 2,025 | permissive | package router
import (
"errors"
"io/fs"
"net/http"
"os"
"path"
"path/filepath"
"strconv"
"time"
"github.com/gofiber/fiber/v2"
"github.com/jinzhu/gorm"
"github.com/naiba/solitudes"
"github.com/naiba/solitudes/internal/model"
"github.com/naiba/solitudes/pkg/translator"
)
func mediaHandler(c *fiber.Ctx) ... |
4b9684b373cb8e3d2a364fc189898d8b23de4c16 | 08e83c995ba8d2f1fc661c227bb10d625fd9ed19 | diandraygp/slides | /golang/examples/trim-newline/trim.go | Go | go | 547 | no_license | package main
import (
"fmt"
"strings"
)
func main() {
line := "hello\n"
line = strings.TrimSuffix(line, "\n") // remove newline
fmt.Printf("'%s'\n", line) // 'hello'
line = strings.TrimSuffix(line, "\n") // not bothered if there was no newline
fmt.Printf("'%s'\n", line) ... |
d3bbc486e9156ac3556df06689a1f6261cfbab74 | c82d036fe7a4bef58f8c17bf15d2b3c9adbb0ac0 | Saodd/Learning | /Golang/src/leetCode/p002x/0021_test.go | Go | go | 1,193 | no_license | package p002x
import (
. "leetCode/utils"
"reflect"
"testing"
)
func Test_mergeTwoLists(t *testing.T) {
type args struct {
l1 *ListNode
l2 *ListNode
}
tests := []struct {
name string
args args
want *ListNode
}{
{
args: args{SliceT... |
590321ecaf377e2de9902e48cb4ca2ed5151886a | cbf2dbefddaa403402166be81cc141cd773de254 | wkarasz/elmobd | /examples/checksupportedcommands.go | Go | go | 501 | permissive | package main
import (
"flag"
"fmt"
"github.com/wkarasz/elmobd"
)
func main() {
serialPath := flag.String(
"serial",
"/dev/ttyUSB0",
"Path to the serial device to use",
)
flag.Parse()
dev, err := elmobd.NewTestDevice(*serialPath, false)
if err != nil {
fmt.Println("Failed to create new device", err)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.