commit stringlengths 40 40 | old_file stringlengths 4 264 | new_file stringlengths 4 264 | old_contents stringlengths 0 4.24k | new_contents stringlengths 1 5.44k | subject stringlengths 14 778 | message stringlengths 15 9.92k | lang stringclasses 277
values | license stringclasses 13
values | repos stringlengths 5 127k |
|---|---|---|---|---|---|---|---|---|---|
0ea3318dc35ee609c75ae2fb9ef67d580191a560 | server/templates.go | server/templates.go | package server
const dockerUnitTemplate = `
[Unit]
Description={{.Name}}
After=docker.service
[Service]
EnvironmentFile=/etc/environment
User=core
TimeoutStartSec=0
ExecStartPre=/usr/bin/docker pull {{.ImagePrefix}}/{{.Name}}:{{.Version}}
ExecStartPre=-/usr/bin/docker rm -f {{.Name}}-{{.Version}}-%i
ExecStart=/usr/bi... | package server
// dockerUnitTemplate is the only currently supported Fleet unit file for
// launching new units. It makes lots of assumptions about how the service is
// configured and stored. These assumptions are essentially the conventions
// that power deployster and are described in more detail in the README.
/... | Add documentation to template in server package. | Add documentation to template in server package.
| Go | mit | bmorton/deployster |
0223d37681f5ba51e00106c9fc146d63f9618fa1 | shell/shell_test.go | shell/shell_test.go | package shell
import (
"testing"
)
func TestGuessFish(t *testing.T) {
if Guess("/usr/local/bin/fish") != Fish {
t.Errorf("Expected /usr/local/bin/fish to match the fish shell")
}
}
func TestGuessZsh(t *testing.T) {
if Guess("/bin/zsh") != Zsh {
t.Errorf("Expected /bin/zsh to match the zsh shell")
}
}
func ... | package shell
import (
"testing"
)
func TestGuessFish(t *testing.T) {
if Guess("/usr/local/bin/fish") != Fish {
t.Errorf("Expected /usr/local/bin/fish to match the fish shell")
}
}
func TestFishCompiles(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Errorf("Expected Fish to be a valid temp... | Test the shell integration template validity | Test the shell integration template validity
| Go | mit | gsamokovarov/jump |
fe66750db93b9c37f02b5f9d81dc906b2335abc5 | interpreter_test.go | interpreter_test.go | package gothic
import (
"testing"
"time"
)
var ir *Interpreter
func init() {
ir = NewInterpreter(nil)
time.Sleep(200 * time.Millisecond)
}
func BenchmarkTcl(b *testing.B) {
ir.Set("N", b.N)
ir.Eval(`
for {set i 1} {$i < $N} {incr i} {
set x 10
}
`)
}
func BenchmarkForeignGo(b *testing.B) {
for i := ... | package gothic
import (
"testing"
"time"
)
var ir *Interpreter
func irinit(b *testing.B) {
if ir == nil {
ir = NewInterpreter(nil)
time.Sleep(200 * time.Millisecond)
}
b.ResetTimer()
}
func BenchmarkTcl(b *testing.B) {
irinit(b)
ir.Set("N", b.N)
ir.Eval(`
for {set i 1} {$i < $N} {incr i} {
set x 1... | Initialize Tcl/Tk interpreter only when actually running benchmarks. | Initialize Tcl/Tk interpreter only when actually running benchmarks.
| Go | mit | nsf/gothic,nsf/gothic,nsf/gothic |
626fe0348385cdb1499af28f90a91c70dc6954e3 | project_test.go | project_test.go | package mathgl
import ()
| package mathgl
import (
"testing"
)
func TestProject(t *testing.T) {
obj := Vec3d{1002, 960, 0}
modelview := Mat4d{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 203, 1, 0, 1}
projection := Mat4d{0.0013020833721384406, 0, 0, 0, -0, -0.0020833334419876337, -0, -0, -0, -0, -1, -0, -1, 1, 0, 1}
initialX, initialY, width, heig... | Add basic test for Project(). | Add basic test for Project().
| Go | bsd-3-clause | mantyr/mathgl,alexvasi/mathgl,go-gl/mathgl |
6d4feed44b19c54144888f3dba74f5c2fa13a014 | db.go | db.go | package hyperdb
// DB represents a collection of objects with multitude of attributes,
// that can be retrieved based all possible dimensions.
type DB struct {
}
// Open creates and opens a database at the given path.
// If the file doesn't exist, it is created automatically.
func Open(path string) (*DB, error) {
re... | package hyperdb
// DB represents a collection of objects with multitude of attributes,
// that can be retrieved based all possible dimensions.
type DB struct {
}
// Open creates and opens a database at the given path.
// If the file doesn't exist, it is created automatically.
func Open(path string) (*DB, error) {
re... | Fix return value in the Add method | Fix return value in the Add method
| Go | mit | mysza/hyperdb |
9d8192804c0d609eef2d7956348358615720a0f3 | pkg/sourcesystem/source_interface.go | pkg/sourcesystem/source_interface.go | package sourcesystem
import (
"os"
"path"
uuid "github.com/satori/go.uuid"
)
// VersionControl is the interface for specific
// version control integrations
type VersionControl interface {
CloneSource(repo *SourceRepository, location string) error
PullSource() error
}
// SourceControlManager is the main system... | package sourcesystem
import (
"os"
"path"
)
// VersionControl is the interface for specific
// version control integrations
type VersionControl interface {
CloneSource(repo *SourceRepository, location string) error
PullSource() error
}
// SourceControlManager is the main system for
// running source control oper... | Remove uuid from project name | Remove uuid from project name
| Go | mpl-2.0 | Gamebuildr/Gogeta,herman-rogers/Gogeta,Gamebuildr/Gogeta,herman-rogers/Gogeta |
7f85af507aaea6d504f0aeddb7e1a6ffd9b8e1d7 | example/main.go | example/main.go | package main
import (
"fmt"
"os"
"strconv"
"github.com/rlayte/toystore"
"github.com/rlayte/toystore/adapters/redis"
)
func main() {
var seed string
if len(os.Args) != 2 {
fmt.Printf("usage: %s [port]", os.Args[0])
os.Exit(1)
}
port, err := strconv.Atoi(os.Args[1])
if err != nil {
panic(err)
}
if ... | package main
import (
"fmt"
"os"
"strconv"
"github.com/rlayte/toystore"
"github.com/rlayte/toystore/adapters/memory"
)
func main() {
var seed string
if len(os.Args) != 2 {
fmt.Printf("usage: %s [port]", os.Args[0])
os.Exit(1)
}
port, err := strconv.Atoi(os.Args[1])
if err != nil {
panic(err)
}
if... | Remove redis from basic example | Remove redis from basic example
| Go | mit | rlayte/toystore |
73bdd5a7a43c6bf034267896eb8905ca7a2d083c | issue211_test.go | issue211_test.go | //go:build !wasm
// +build !wasm
package torrent
import (
"io"
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/time/rate"
"github.com/anacrolix/torrent/internal/testutil"
"github.com/anacrolix/torrent/storage"
)
func TestDropTorrentWithMmapStor... | //go:build !wasm
// +build !wasm
package torrent
import (
"io"
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/time/rate"
"github.com/anacrolix/torrent/internal/testutil"
"github.com/anacrolix/torrent/storage"
)
func TestDropTorrentWithMmapStor... | Fix leaked mmap storage in test | Fix leaked mmap storage in test
| Go | mpl-2.0 | anacrolix/torrent,anacrolix/torrent |
f8328f75917c22c0a34ee938d31d3dce4503b4c9 | pull/releasepull.go | pull/releasepull.go | package pull
import (
"fmt"
"io"
"net/http"
"os"
"path"
"github.com/mitchellh/ioprogress"
)
func NewRelease(cache string) *Release {
return &Release{CacheDir: cache}
}
type Release struct {
CacheDir string
}
// Pull downloads the specified Release to the local cache dir
func (s *Release) Pull(url string) (... | package pull
import (
"fmt"
"io"
"net/http"
"os"
"path"
"github.com/mitchellh/ioprogress"
)
// NewRelease creates a new Release instance
func NewRelease(cache string) *Release {
return &Release{CacheDir: cache}
}
// Release is a BOSH release with a configurable cache dir
type Release struct {
CacheDir strin... | Add comments to public functions | Add comments to public functions
| Go | apache-2.0 | enaml-ops/enaml,xchapter7x/enaml |
8a9962882ccd1dda3cdb9708d3db3205d40deb4a | builder/hyperv/common/ssh.go | builder/hyperv/common/ssh.go | package common
import (
"log"
"github.com/hashicorp/packer/helper/multistep"
)
func CommHost(host string) func(multistep.StateBag) (string, error) {
return func(state multistep.StateBag) (string, error) {
if host != "" {
log.Println("Using ssh_host value: %s", ipAddress)
return host, nil
}
vmName :=... | package common
import (
"log"
"github.com/hashicorp/packer/helper/multistep"
)
func CommHost(host string) func(multistep.StateBag) (string, error) {
return func(state multistep.StateBag) (string, error) {
if host != "" {
log.Printf("Using ssh_host value: %s", host)
return host, nil
}
vmName := state... | Use Printf not Println. D'oh. | Use Printf not Println. D'oh.
| Go | mpl-2.0 | mitchellh/packer,pecigonzalo/packer,mkuzmin/packer,bryson/packer,ricardclau/packer,paulmey/packer,bryson/packer,ricardclau/packer,paulmey/packer,dave2/packer,pecigonzalo/packer,tas50/packer,bryson/packer,rnaveiras/packer,timsutton/packer,hashicorp/packer,paulmey/packer,timsutton/packer,tas50/packer,grubernaut/packer,yo... |
162e6f09b73fc835780e19886fb71a3899436cce | src/aguin/utils/logging.go | src/aguin/utils/logging.go | package utils
import (
"log"
"os"
"fmt"
)
func GetLogger(prefix string) *Logger {
return New(prefix)
}
func New(prefix string) *Logger {
l := new(Logger)
l.logger = log.New(os.Stdout, fmt.Sprintf("[%s] ", prefix), log.LstdFlags)
return l
}
type Logger struct {
logger *log.Logger
}
func (l *Logger) Critical... | package utils
import (
"log"
"os"
"fmt"
)
var loggers = make(map[string]*Logger)
func GetLogger(prefix string) *Logger {
if logger, ok := loggers[prefix]; ok {
return logger
}
loggers[prefix] = New(prefix)
return loggers[prefix]
}
func New(prefix string) *Logger {
l := new(Logger)
l.logger = log.New(os.... | Return same logger for each prefix | Return same logger for each prefix
| Go | mit | vanng822/aguin,vanng822/aguin,vanng822/aguin,vanng822/aguin,vanng822/aguin |
29bf109de0b6abfb3532d05bc612e0636b7adfa6 | chapter15/scorecombination_test.go | chapter15/scorecombination_test.go | package chapter15
import "testing"
var scoreCombinationTests = []struct {
W []int
s int
expected int
}{
{[]int{2, 3, 7}, 12, 4},
}
func TestScoreCombination(t *testing.T) {
for _, tt := range scoreCombinationTests {
actual := ScoreCombination(tt.W, tt.s)
if actual != tt.expected {
t.Errorf(... | package chapter15
import "testing"
var scoreCombinationTests = []struct {
W []int
s int
expected int
}{
{[]int{2, 3, 7}, 12, 4},
{[]int{1, 2, 3}, 4, 4},
{[]int{2, 3, 5, 6}, 10, 5},
}
func TestScoreCombination(t *testing.T) {
for _, tt := range scoreCombinationTests {
actual := ScoreCombination... | Add some test cases to scoreCombinationTests | Add some test cases to scoreCombinationTests
| Go | mit | akshaykumar90/sparkling-water |
325714ab560d5fbfd76b90813381cec444758552 | pkg/options/options.go | pkg/options/options.go | /*
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 writing, software
dis... | /*
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 writing, software
dis... | Change the --enable-policy-routing's default value from true to false. | Change the --enable-policy-routing's default value from true to false.
| Go | apache-2.0 | GoogleCloudPlatform/netd,GoogleCloudPlatform/netd,GoogleCloudPlatform/netd |
e8e795c97378e6bd4cf6d693c23e6d8e90429a4e | sample/sample.go | sample/sample.go | package main
import (
"fmt"
"time"
)
func assertEqual(a interface{}, b interface{}) {
if a != b {
panic(fmt.Sprint("Expected ", a, ", but got ", b))
}
}
func fib(n int) int {
if n < 2 {
return 1
}
return fib(n - 1) + fib(n - 2)
}
func addOne(x int) int {
return x + 1
}
func testMath() {
assertEqual(2,... | package main
import (
"fmt"
"time"
)
func assertEqual(a interface{}, b interface{}) {
if a != b {
panic(fmt.Sprint("Expected ", a, ", but got ", b))
}
}
func fib(n int) int {
if n < 2 {
return 1
}
return fib(n - 1) + fib(n - 2)
}
func addOne(x int) int {
return x + 1
}
func testMath() {
assertEqual(2,... | Change timing to time the full test suite | Change timing to time the full test suite
This gives us a more realistic picture of the perf of native vs interpreted
code.
| Go | mit | alangpierce/apgo |
a910ba609fb67654120cd539e65caa686c8e894e | clearScreen.go | clearScreen.go | package wmenu
import (
"os"
"os/exec"
"runtime"
)
var clear map[string]func()
func init() {
clear = make(map[string]func())
clear["linux"] = func() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
cmd.Run()
}
clear["darwin"] = func() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
cmd.R... | package wmenu
import (
"os"
"os/exec"
"runtime"
)
var clear map[string]func()
func init() {
clear = make(map[string]func())
clear["linux"] = func() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
cmd.Run()
}
clear["darwin"] = func() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
cmd.R... | Fix clear screen function on windows | Fix clear screen function on windows
See http://stackoverflow.com/questions/19209425/how-can-i-clear-the-console-with-golang-in-windows#comment29035981_19290028 for more information on why this is needed | Go | mit | dixonwille/wmenu |
6e8b5de82a26d9d0000ae7ce5669eef8052123e9 | handlers/stop_app_handler.go | handlers/stop_app_handler.go | package handlers
import (
"net/http"
"github.com/cloudfoundry-incubator/bbs"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/pivotal-golang/lager"
)
type StopAppHandler struct {
bbsClient bbs.Client
logger lager.Logger
}
func NewStopAppHandler(logger lager.Logger, bbsClient bbs.Client) *StopAppH... | package handlers
import (
"net/http"
"github.com/cloudfoundry-incubator/bbs"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/pivotal-golang/lager"
)
type StopAppHandler struct {
bbsClient bbs.Client
logger lager.Logger
}
func NewStopAppHandler(logger lager.Logger, bbsClient bbs.Client) *StopAppH... | Add helpful logging to app stop handler | Add helpful logging to app stop handler
To mirror similar logging in the desire app handler
[#107962562]
Signed-off-by: Kira Combs <327dac51f3a5158dc1dbf428a088e367dce1ec10@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/nsync |
028f8b142966611391d41c41671d61138d1c4b4f | cmd/mdbd/loadDsHostFqdn.go | cmd/mdbd/loadDsHostFqdn.go | package main
import (
"encoding/json"
"errors"
"github.com/Symantec/Dominator/lib/mdb"
"io"
"log"
)
func loadDsHostFqdn(reader io.Reader, datacentre string, logger *log.Logger) (
*mdb.Mdb, error) {
type machineType struct {
Fqdn string
}
type dataCentreType map[string]machineType
type inMdbType map[stri... | package main
import (
"encoding/json"
"errors"
"github.com/Symantec/Dominator/lib/mdb"
"io"
"log"
)
func loadDsHostFqdn(reader io.Reader, datacentre string, logger *log.Logger) (
*mdb.Mdb, error) {
type machineType struct {
Fqdn string
}
type dataCentreType map[string]machineType
type inMdbType map[stri... | Remove hack in mdbd fs.host.fqdn driver. | Remove hack in mdbd fs.host.fqdn driver.
| Go | apache-2.0 | rgooch/Dominator,keep94/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,Symantec/Dominator |
5807fc82c880ac3da3b9348805113b5a35e5a8c3 | internal/gateway/frontend/hmac.go | internal/gateway/frontend/hmac.go | package frontend
import (
"crypto/hmac"
"crypto/sha1"
)
// ComputeHMAC of a message using a specific key
func ComputeHMAC(message []byte, key string) []byte {
mac := hmac.New(sha1.New, []byte(key))
mac.Write(message)
return mac.Sum(nil)
}
// CheckHMAC of a message
func CheckHMAC(message, messageHMAC []byte, key... | package frontend
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
)
// ComputeHMAC of a message using a specific key
func ComputeHMAC(message []byte, key string) []byte {
mac := hmac.New(sha1.New, []byte(key))
mac.Write(message)
return []byte(hex.EncodeToString(mac.Sum(nil)))
}
// CheckHMAC of a message
fun... | Change HMAC computation to match the cvmfs server tools | Change HMAC computation to match the cvmfs server tools
| Go | bsd-3-clause | cvmfs/cvmfs_services,cvmfs/cvmfs_services |
597e4bc46519afb8757ab000b9b260fa72d0247f | database_accessor.go | database_accessor.go | package nigronimgosession
import (
"net/http"
"github.com/gorilla/context"
mgo "gopkg.in/mgo.v2"
)
type DatabaseAccessor struct {
*mgo.Session
url string
name string
coll string
}
func NewDatabaseAccessor(url, name, coll string) (*DatabaseAccessor, error) {
session, err := mgo.Dial(url)
if err == nil {
... | package nigronimgosession
import (
"net/http"
"github.com/gorilla/context"
mgo "gopkg.in/mgo.v2"
)
type DatabaseAccessor struct {
*mgo.Session
url string
name string
coll string
}
func NewDatabaseAccessor(url, name, coll string) (*DatabaseAccessor, error) {
session, err := mgo.Dial(url)
if err == nil {
... | Change the request keys to a more redeable name | Change the request keys to a more redeable name
| Go | mit | joeljames/nigroni-mgo-session |
864ce94d09e4cb63dc98fc15dca8f9440597d746 | 2016/day5/day5.go | 2016/day5/day5.go | package day5
func Solution() string {
return decode("abbhdwsy")
}
func decode(input string) string {
return "Not yet solved"
}
| package day5
import (
"crypto/md5"
"fmt"
"strings"
)
func Solution() string {
return decode("abbhdwsy")
}
const prefix = "00000"
func decode(input string) string {
suffix := int32(0)
code := ""
for i := 0; i < 8; i++ {
searching := true
for searching {
data := []byte(fmt.Sprintf("%s%d", input, suffi... | Add brute force solution for day 5 part 1 | Add brute force solution for day 5 part 1
| Go | mit | domdavis/adventofcode |
4040efc4e8c244ac97e6638738423da391cbeaa3 | examples/workers1.go | examples/workers1.go | package main
import (
"fmt"
"sync"
"time"
)
func worker(ch <-chan int, wg *sync.WaitGroup) {
defer wg.Done()
for {
task, ok := <-ch
if !ok {
return
}
time.Sleep(1 * time.Millisecond)
fmt.Println("processing task", task)
}
}
func pool(wg *sync.WaitGroup, workers, tasks int) {
ch := make(chan int)
... | package main
import (
"fmt"
"os"
"runtime/trace"
"sync"
"time"
)
func worker(ch <-chan int, wg *sync.WaitGroup) {
defer wg.Done()
for {
task, ok := <-ch
if !ok {
return
}
time.Sleep(1 * time.Millisecond)
fmt.Println("processing task", task)
}
}
func pool(wg *sync.WaitGroup, workers, tasks int) {... | Add trace to examples worker1 | Add trace to examples worker1
| Go | mit | divan/gotrace,divan/gotrace,divan/gotrace |
3465cbb27a0af0b042651b2c6c49bcc296bc131a | server/language_pool.go | server/language_pool.go | package server
import (
"errors"
"sync"
)
type LanguagePool struct {
mutex sync.RWMutex
languages map[string]*Language
}
func NewLanguagePool() *LanguagePool {
p := new(LanguagePool)
p.languages = make(map[string]*Language)
return p
}
func (lp *LanguagePool) Add(l *Language) error {
lp.mutex.Lock()
def... | package server
import (
"errors"
"sync"
)
type LanguagePool struct {
mutex sync.RWMutex
languages map[string]*Language
}
func NewLanguagePool() *LanguagePool {
p := new(LanguagePool)
p.languages = make(map[string]*Language)
return p
}
func (lp *LanguagePool) Add(l *Language) error {
lp.mutex.Lock()
def... | Add Broadcast to LanguagePool and make Get create new language | Add Broadcast to LanguagePool and make Get create new language
| Go | mit | MStoykov/mazungumzo |
f81db2b578362cd241544cc1a0ec5cf942adf222 | window/build.go | window/build.go | package window
/*
#cgo darwin CFLAGS: -D_GOSMF_OSX_
#cgo darwin LDFLAGS: -F/Library/Frameworks -framework SDL2
#cgo linux CFLAGS: -D_GOSMF_LINUX_
#cgo linux LDFLAGS: -lSDL2main -lSDL2
#cgo windows CFLAGS: -D_GOSMF_WINDOWS_
#cgo windows LDFLAGS: -lSDL2main -lSDL2
*/
import "C"
| package window
/*
#cgo darwin CFLAGS: -D_GOSMF_OSX_
#cgo darwin LDFLAGS: -L/usr/local/lib -lSDL2
#cgo linux CFLAGS: -D_GOSMF_LINUX_
#cgo linux LDFLAGS: -lSDL2main -lSDL2
#cgo windows CFLAGS: -D_GOSMF_WINDOWS_
#cgo windows LDFLAGS: -lSDL2main -lSDL2
*/
import "C"
| Change linking of sdl library | Change linking of sdl library
| Go | mit | anthonyrego/gosmf,anthonyrego/dodge |
f913d71d8808825ea2358731fc464e5aae542b57 | util/util.go | util/util.go | package util
import "fmt"
import "os"
func MaybePanic(err error) {
if err != nil {
panic(err)
}
}
func Debugging() bool {
return os.Getenv("GOLOG_DEBUG") != ""
}
func Debugf(format string, args ...interface{}) {
if Debugging() {
fmt.Printf(format, args...)
}
}
| package util
import "fmt"
import "os"
func MaybePanic(err error) {
if err != nil {
panic(err)
}
}
func Debugging() bool {
return os.Getenv("GOLOG_DEBUG") != ""
}
func Debugf(format string, args ...interface{}) {
if Debugging() {
fmt.Fprintf(os.Stderr, format, args...)
}
}
| Send debugging messages to stderr | Send debugging messages to stderr
| Go | mit | vzaramel/golog,vzaramel/golog,samuell/golog,bransorem/golog,mndrix/golog,bransorem/golog,mndrix/golog,samuell/golog |
70b573255d307ac730393fdf5550e32566773ff6 | daemon/http.go | daemon/http.go | //
// Copyright 2016 Gregory Trubetskoy. 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... | //
// Copyright 2016 Gregory Trubetskoy. 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... | Add a /ping URL for the load balancer | Add a /ping URL for the load balancer
| Go | apache-2.0 | tgres/tgres |
d05bfb08733e4d0a95fc576aa695c74a0af12e83 | types/common.go | types/common.go | package types
// DataFreshness codes for a specific data freshness requirement: realtime or base_schedule
type DataFreshness string
const (
// DataFreshnessRealTime means you'll get undisrupted journeys
DataFreshnessRealTime DataFreshness = "realtime"
// DataFreshnessBaseSchedule means you can get disrupted journe... | /*
Package types implements support for the types used in the Navitia API (see doc.navitia.io), simplified and modified for idiomatic Go use.
This package was and is developped as a supporting library for the gonavitia API client (https://github.com/aabizri/gonavitia) but can be used to build other API clients.
This ... | Add package-level documentation for gonavitia/types | Add package-level documentation for gonavitia/types
| Go | unlicense | aabizri/navitia,aabizri/navitia |
f57ecc7843924ef84d65f79ee4fbaf6828a47097 | fs/fstestutil/timeout.go | fs/fstestutil/timeout.go | package fstestutil
import (
"flag"
"time"
)
// SetDefaultTimeout sets the default value for the `go test
// -test.timeout` flag. Original default is no timeout.
func SetDefaultTimeout(d time.Duration) {
f := flag.Lookup("test.timeout")
if f.Value.String() != "0" {
// not at default value
return
}
f.DefValue... | package fstestutil
import (
"flag"
"testing"
"time"
)
// SetDefaultTimeout sets the default value for the `go test
// -test.timeout` flag. Original default is no timeout.
func SetDefaultTimeout(d time.Duration) {
testing.Init()
f := flag.Lookup("test.timeout")
if f == nil {
panic("flag -test.timeout not found... | Fix fstestutil.SetDefaultTimeout looking up flags too early | Fix fstestutil.SetDefaultTimeout looking up flags too early
Improve the diagnostic message when things fail.
| Go | mit | bazil/bazil |
4aad531aaa72867ae486204f8b3e8f47d4bd1c93 | cryptobox/crypto_box_seal.go | cryptobox/crypto_box_seal.go | package cryptobox
// #cgo pkg-config: libsodium
// #include <stdlib.h>
// #include <sodium.h>
import "C"
import "github.com/GoKillers/libsodium-go/support"
func CryptoBoxSeal(m []byte, pk []byte) ([]byte, int) {
support.CheckSize(pk, CryptoBoxPublicKeyBytes(), "public key")
c := make([]byte, len(m)+CryptoBoxMacByte... | package cryptobox
// #cgo pkg-config: libsodium
// #include <stdlib.h>
// #include <sodium.h>
import "C"
import "github.com/GoKillers/libsodium-go/support"
func CryptoBoxSeal(m []byte, pk []byte) ([]byte, int) {
support.CheckSize(pk, CryptoBoxPublicKeyBytes(), "public key")
c := make([]byte, len(m)+CryptoBoxSealByt... | Fix number of extra bytes for CryptoBoxSeal and CryptoBoxSealOpen | Fix number of extra bytes for CryptoBoxSeal and CryptoBoxSealOpen
| Go | isc | GoKillers/libsodium-go,GoKillers/libsodium-go |
df804918f401bc011af8ef2af0f1732ccdc0166e | uuid/uuid_test.go | uuid/uuid_test.go | package uuid
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
"fmt"
"regexp"
)
func TestNew(t *testing.T) {
Convey("uuid", t, func() {
uuid := New()
Convey("is in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx", func() {
const uuid4Pattern = `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9... | package uuid
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
"regexp"
)
func TestNew(t *testing.T) {
Convey("uuid", t, func() {
uuid := New()
Convey("is in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx", func() {
const uuid4Pattern = `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a... | Remove unused import in test | Remove unused import in test
| Go | apache-2.0 | SkygearIO/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server,rickmak/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
80a575201b29ef1436ac1f4f6e1721e0753404cd | main.go | main.go | package main
import (
"os"
"github.com/intelsdi-x/pulse/control/plugin"
"github.com/intelsdi-x/pulse/plugin/publisher/pulse-publisher-riemann/riemann"
)
func main() {
// Three things are provided:
// - The definition of the plugin metadata
// - The implementation satisfying plugin.PublisherPlugin
// - The pub... | package main
import (
"os"
"github.com/intelsdi-x/pulse-plugin-publisher-riemann/riemann"
"github.com/intelsdi-x/pulse/control/plugin"
)
func main() {
// Three things are provided:
// - The definition of the plugin metadata
// - The implementation satisfying plugin.PublisherPlugin
// - The publisher config po... | Update import for riemann package | Update import for riemann package
| Go | apache-2.0 | intelsdi-x/snap-plugin-publisher-riemann,intelsdi-x/snap-plugin-publisher-riemann,intelsdi-x/snap-plugin-publisher-riemann |
80b8403e231b86355ee00794c562ec9eee9e964b | main.go | main.go | package main
import (
log "github.com/sirupsen/logrus"
"runtime"
"github.com/spf13/pflag"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
var dataFolder string
var indexPath string
var addr string
var forceRebuild bool
var baseURL string
pflag.StringVar(&dataFolder, "data-path", "", "Path to the pyvi... | package main
import (
log "github.com/sirupsen/logrus"
"runtime"
"github.com/spf13/pflag"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
var dataFolder string
var indexPath string
var addr string
var forceRebuild bool
var baseURL string
pflag.StringVar(&dataFolder, "data-path", "", "Path to the pyvi... | Add check for --data-path argument | Add check for --data-path argument
| Go | mit | zerok/pyvideosearch |
d9404fe88017921072bcfc15305e0700c35adb47 | ldb/boundary_test.go | ldb/boundary_test.go | // Copyright (c) 2013 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package ldb_test
import (
"github.com/conformal/btcdb"
"os"
"testing"
)
// we need to test for empty databas and make certain it returns proper value
func TestEmptyDB(t ... | // Copyright (c) 2013 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package ldb_test
import (
"github.com/conformal/btcdb"
"github.com/conformal/btcwire"
"os"
"testing"
)
// we need to test for empty databas and make certain it returns p... | Correct test for zero hash versus nil on empty db. | Correct test for zero hash versus nil on empty db.
| Go | isc | decred/dcrd,soapboxsys/ombfullnode,danoctavian/btcd,jimmysong/btcd,davecgh/btcd,danoctavian/btcd,cjepson/btcd,qchain/btcd,Cleawing/btcd,qchain/btcd,cjepson/btcd,btcsuitereleases/btcd,Cleawing/btcd,toddfries/btcd,Dirbaio/btcd,Dirbaio/btcd,decred/dcrd,adiabat/btcd,ltcsuite/ltcd,stevenroose/btcd,ppcsuite/ppcd-old,hectorj/... |
71e005638bed8433ff67bd8c0b9516435badc28c | goals-calendar.go | goals-calendar.go | package main
import "goldorak"
func main() {
/******************/
/* Initialization */
/******************/
goldorak.Initialize("config.json")
//calendar := goldorak.NewModel("calendar")
/***********/
/* Actions */
/***********/
// Layout
goldorak.DefaultLayout(func(action *goldorak.Action) {
action.Ass... | package main
import (
"goldorak"
"strconv"
)
func main() {
/******************/
/* Initialization */
/******************/
goldorak.Initialize("config.json")
conn := goldorak.Connect()
calendar := conn.NewModel("calendar")
/***********/
/* Actions */
/***********/
// Layout
goldorak.DefaultLayout(func(... | Use the new API for models | Use the new API for models
| Go | agpl-3.0 | nono/goals-calendar |
30f677249eef79da5e75cbfd35ed4df78c014e22 | AnimeAiringDate.go | AnimeAiringDate.go | package arn
import "time"
// AnimeAiringDate ...
type AnimeAiringDate struct {
Start string `json:"start"`
End string `json:"end"`
}
// StartDateHuman ...
func (airing *AnimeAiringDate) StartDateHuman() string {
t, _ := time.Parse(time.RFC3339, airing.Start)
return t.Format(time.RFC1123)
}
// EndDateHuman ...... | package arn
import "time"
// AnimeAiringDate ...
type AnimeAiringDate struct {
Start string `json:"start"`
End string `json:"end"`
startHumanReadable string
endHumanReadable string
}
// StartDateHuman ...
func (airing *AnimeAiringDate) StartDateHuman() string {
if airing.startHumanReadable == "" {
t, _ :... | Split airing date and time | Split airing date and time
| Go | mit | animenotifier/arn |
bb490c1e2c7deddeeaf230587b0373eb37510e8c | src/obs2vagrant/main.go | src/obs2vagrant/main.go | // This is a simple web application that makes possible to use Open Build
// Service as a simple Vagrant image catalog.
package main
import (
"flag"
"fmt"
"log"
"net/http"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
)
// Returns the "Not found" response.
func notFound(w http.ResponseWriter, req *... | // This is a simple web application that makes possible to use Open Build
// Service as a simple Vagrant image catalog.
package main
import (
"flag"
"fmt"
"log"
"net/http"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
)
// Returns the "Not found" response.
func notFound(w http.ResponseWriter, req *... | Update code to work with latest version of mux | Update code to work with latest version of mux
Add explicit support to HEAD requests otherwise Vagrant will stop
working.
| Go | mit | flavio/obs2vagrant |
b26be598a4d43dce762c4ec2ce9f3b6f2e2b9484 | cmd/update-make/main.go | cmd/update-make/main.go | package main
import (
"flag"
log "github.com/Sirupsen/logrus"
"github.com/fubarhouse/golang-drush/makeupdater"
"strings"
)
func main() {
var strMake = flag.String("makes", "", "Comma-separated list of absolute paths to make files to update.")
flag.Parse()
if *strMake != "" {
Makes := strings.Split(*strMake, ... | package main
import (
"flag"
log "github.com/Sirupsen/logrus"
"github.com/fubarhouse/golang-drush/makeupdater"
"strings"
)
func main() {
var strMake = flag.String("makes", "", "Comma-separated list of absolute paths to make files to update.")
flag.Parse()
if *strMake != "" {
Makes := strings.Split(*strMake, ... | Add a duplicate project reporting system into the update-make binary. | Add a duplicate project reporting system into the update-make binary.
| Go | mit | fubarhouse/golang-drush |
41f272498df15bce6bf8c0e5857d5b4ecc8673db | util/sync.go | util/sync.go | package util
import (
"net/http"
"sync"
)
type StatusGroup struct {
sync.WaitGroup
sync.Mutex
Status int
Err error
}
func NewStatusGroup() *StatusGroup {
return &StatusGroup{Status: http.StatusOK}
}
func (sg *StatusGroup) Done(status int, err error) {
sg.Lock()
if sg.Err == nil && err != nil {
if stat... | package util
import (
"fmt"
"net/http"
"sync"
)
type StatusGroup struct {
sync.WaitGroup
sync.Mutex
Status int
Err error
}
func NewStatusGroup() *StatusGroup {
return &StatusGroup{Status: http.StatusOK}
}
func (sg *StatusGroup) Done(status int, err error) {
if status == 0 {
// An early exit.
status ... | Fix a minor bug in StatusGroup. | Fix a minor bug in StatusGroup.
err was not set when status == 0
| Go | mit | tsinghua-io/api-server |
e697d2248a6305d0ca9f044499b9538c8cb7f8de | util_test.go | util_test.go | package simpledb_test
import (
"github.com/garyburd/redigo/redis"
"github.com/northbright/simpledb"
)
func Example_GetRedisHashMaxZiplistEntries() {
var err error
var redisHashMaxZiplistEntries uint64 = 0
simpledb.DebugPrintf("\n")
simpledb.DebugPrintf("--------- GetRedisHashMaxZiplistEntries() Test Begin ----... | package simpledb_test
import (
"github.com/garyburd/redigo/redis"
"github.com/northbright/simpledb"
)
func ExampleGetRedisHashMaxZiplistEntries() {
var err error
var redisHashMaxZiplistEntries uint64 = 0
simpledb.DebugPrintf("\n")
simpledb.DebugPrintf("--------- GetRedisHashMaxZiplistEntries() Test Begin -----... | Fix malformed example suffix for a function. | Fix malformed example suffix for a function.
| Go | mit | northbright/simpledb |
99c77b4fe093261e4b9493c3e4e1b3c66b61b6c1 | etcd/etcd.go | etcd/etcd.go | package etcd
import (
"errors"
"github.com/coreos/go-etcd/etcd"
"github.com/kelseyhightower/confd/config"
"path/filepath"
"strings"
)
var machines = []string{
"http://127.0.0.1:4001",
}
var prefix string = "/"
func GetValues(keys []string) (map[string]interface{}, error) {
vars := make(map[string]interface{})... | package etcd
import (
"errors"
"github.com/coreos/go-etcd/etcd"
"github.com/kelseyhightower/confd/config"
"path/filepath"
"strings"
)
func GetValues(keys []string) (map[string]interface{}, error) {
vars := make(map[string]interface{})
c := etcd.NewClient()
success := c.SetCluster(config.EtcdNodes())
if !succ... | Remove unused machines and prefix vars | Remove unused machines and prefix vars
| Go | mit | openedbox/confd,crunchywelch/confd,Flipkart/confd,shencan/confd,agilemobiledev/confd,bacongobbler/confd,jnummelin/confd,israelchen/confd,zytek/confd,aledbf/confd,zytek/confd,linearregression/confd,monder/confd,kelseyhightower/confd,openedbox/confd,blippar/confd,crandles/confd,elsonrodriguez/confd,layerhq/confd,cloudnau... |
45f38011785c767dfa958e4b26db3e53bb1f9b60 | parser_test.go | parser_test.go | package golog
import "testing"
func TestBasic(t *testing.T) {
single := make(map[string]string)
single[`hello.`] = `hello`
single[`a + b.`] = `+(a, b)`
single[`first, second.`] = `','(first, second)`
single[`\+ j.`] = `\+(j)`
for test, wanted := range single {
got, err := ReadTermStrin... | package golog
import "testing"
func TestBasic(t *testing.T) {
single := make(map[string]string)
single[`hello.`] = `hello`
single[`a + b.`] = `+(a, b)`
single[`first, second.`] = `','(first, second)`
single[`\+ j.`] = `\+(j)`
single[`a + b*c.`] = `+(a, *(b, c))` // test precedence
singl... | Test operator precedence and associativity | Test operator precedence and associativity
| Go | mit | bransorem/golog,vzaramel/golog,samuell/golog,bransorem/golog,mndrix/golog,mndrix/golog,vzaramel/golog,samuell/golog |
5cb367b394300af15f1e850c7cfcb240b4552e13 | src/bio/align/pals/filter/dphits.go | src/bio/align/pals/filter/dphits.go | package filter
// Copyright ©2011 Dan Kortschak <dan.kortschak@adelaide.edu.au>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your opti... | package filter
// Copyright ©2011 Dan Kortschak <dan.kortschak@adelaide.edu.au>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your opti... | Add note about sort stability | Add note about sort stability
| Go | bsd-3-clause | biogo/biogo,brentp/biogo,biogo/biogo,mnsmar/biogo,mnsmar/biogo,brentp/biogo |
68ef438869b00ec2a3bd41a1c2e078e973a18143 | repeating_otp/solver_test.go | repeating_otp/solver_test.go | package repeating_otp
import (
"testing"
"io/ioutil"
"github.com/stretchr/testify/require"
"encoding/base64"
)
func Test_Solve_1(t *testing.T) {
input, err := ioutil.ReadFile("challenge-6.txt")
require.Nil(t, err)
input_decoded := make([]byte, base64.StdEncoding.DecodedLen(len(input)))
base64.StdEncoding.Dec... | package repeating_otp
import (
"testing"
"io/ioutil"
"github.com/stretchr/testify/require"
"fmt"
"encoding/hex"
)
func Test_Solve_1(t *testing.T) {
input, err := ioutil.ReadFile("challenge-6-raw")
require.Nil(t, err)
plaintext, key, score := Solve(input)
if plaintext == nil {
fmt.Printf("plaintext is nil... | Use raw file as input, Printing niceties | Use raw file as input, Printing niceties
| Go | mit | cngkaygusuz/matasano-challenges,ckaygusu/matasano-challenges |
dc6a6023d3911c0b36b29fd148ab6ea327a9bd79 | classifier.go | classifier.go | package perceptron
import (
"github.com/mitsuse/perceptron-go/vector"
)
type Classifier struct {
model *Model
}
func NewClassifier(indexer Indexer) *Classifier {
c := &Classifier{
model: &Model{
weight: vector.NewZeroDense(0),
indexer: indexer,
},
}
return c
}
func (c *Classifier) Weight() vector.V... | package perceptron
import (
"github.com/mitsuse/perceptron-go/vector"
)
type Classifier struct {
model *Model
}
func NewClassifier(indexer Indexer) *Classifier {
c := &Classifier{
model: &Model{
weight: vector.NewZeroDense(0),
indexer: indexer,
},
}
return c
}
func (c *Classifier) Update(learner Le... | Remove "(*Classifier).Weight" to prohibit the access to weight vector from the outside. | Remove "(*Classifier).Weight" to prohibit the access to weight vector from the outside.
| Go | mit | mitsuse/perceptron-go,mitsuse/perceptron-go |
bb11ad1a15907feb9304f55a26a95bed77291f1d | pkg/proxy/defaults.go | pkg/proxy/defaults.go | // Copyright 2017 Authors of Cilium
//
// 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 ... | // Copyright 2017 Authors of Cilium
//
// 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 ... | Reduce SO_LINGER timeout to 10 seconds | proxy: Reduce SO_LINGER timeout to 10 seconds
The existing value of 1 minute can put a lot of stress on the proxymap table in
an environment with many concurrent, short lived connections.
Signed-off-by: Thomas Graf <5f50a84c1fa3bcff146405017f36aec1a10a9e38@cilium.io>
| Go | apache-2.0 | tklauser/cilium,tgraf/cilium,eloycoto/cilium,scanf/cilium,tgraf/cilium,cilium/cilium,cilium-team/cilium,eloycoto/cilium,scanf/cilium,scanf/cilium,michi-covalent/cilium,scanf/cilium,michi-covalent/cilium,eloycoto/cilium,tklauser/cilium,tgraf/cilium,eloycoto/cilium,eloycoto/cilium,tgraf/cilium,michi-covalent/cilium,michi... |
3a2ea8f473928ec022b208186fa35fac76f78256 | internal/interop/interop.go | internal/interop/interop.go | package interop
import (
"syscall"
"unsafe"
)
//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go interop.go
//sys coTaskMemFree(buffer unsafe.Pointer) = ole32.CoTaskMemFree
func ConvertAndFreeCoTaskMemString(buffer *uint16) string {
str := syscall.UTF16ToString((*[1 << 30]u... | package interop
import (
"syscall"
"unsafe"
)
//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go interop.go
//sys coTaskMemFree(buffer unsafe.Pointer) = ole32.CoTaskMemFree
func ConvertAndFreeCoTaskMemString(buffer *uint16) string {
str := syscall.UTF16ToString((*[1 << 29]u... | Fix ConvertAndFreeCoTaskMemString for 32 bit platforms | Fix ConvertAndFreeCoTaskMemString for 32 bit platforms
| Go | mit | madhanrm/hcsshim,Microsoft/hcsshim |
00e788ad4469dbc25f09d8a5ac63295dd4bdde83 | sentry/errors.go | sentry/errors.go | package sentry
import "fmt"
// APIError represents a Sentry API Error response
type APIError map[string]interface{}
// TODO: use this instead
// type apiError struct {
// Detail string `json:"detail"`
// }
func (e APIError) Error() string {
return fmt.Sprintf("sentry: %v", e)
}
// Empty returns true if empty.
fu... | package sentry
import "fmt"
// APIError represents a Sentry API Error response
type APIError map[string]interface{}
// TODO: use this instead
// type apiError struct {
// Detail string `json:"detail"`
// }
func (e APIError) Error() string {
if len(e) == 1 {
if detail, ok := e["detail"].(string); ok {
return ... | Address infinite recursion bug when requesting string representation of APIError | Address infinite recursion bug when requesting string representation of APIError
| Go | mit | jianyuan/go-sentry |
3c3ac4df138618ce3d434acbe0756cf2503bfcf8 | lib/elements/cloud/azure.go | lib/elements/cloud/azure.go | package cloud
import (
"encoding/json"
"fmt"
"net/http"
"strings"
)
const azure_metadata_url = "http://169.254.169.254/metadata/latest/instance/"
func getAzureData(url string) (data []string) {
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return make([]string, 0)
}
// Microsoft requires thi... | package cloud
import (
"fmt"
"net/http"
)
const azure_metadata_url = "http://169.254.169.254/metadata/instance?api-version=2021-02-01&format=json"
func GetAzureElements() (map[string]interface{}, error) {
req, err := http.NewRequest("GET", azure_metadata_url, nil)
if err != nil {
return nil, fmt.Errorf("error ... | Fix metadata lookup for Azure | Fix metadata lookup for Azure
| Go | mit | erichs/elements |
9d3b8834aa3e1d26fdfa5b0cc8bec4da431b053b | gen/config.go | gen/config.go | package gen
type Config struct {
Source string `json:"source"`
Destination string `json:'destination"`
Safe bool `json:"safe"`
Excluede []string `json:"exclude"`
Include string `json""include"`
KeepFiles string `json:"keep_files"`
TimeZone string `json:"timezone"`
Encoding... | package gen
type Config struct {
Source string `json:"source"`
Destination string `json:'destination"`
Safe bool `json:"safe"`
Excluede []string `json:"exclude"`
Include string `json""include"`
KeepFiles string `json:"keep_files"`
TimeZone string `json:"timezone"`
Encoding... | Add WorkDir field to System struct | Add WorkDir field to System struct
| Go | mit | gernest/wuxia,gernest/wuxia,gernest/wuxia,gernest/wuxia |
f3e535d42face26f6ed0391a947bc376976ccb24 | server/router.go | server/router.go | package main
import (
"github.com/NYTimes/gziphandler"
"github.com/discoviking/website/server/storage"
"github.com/gorilla/mux"
"net/http"
)
func createRouter(storageService storage.Service) *mux.Router {
// Main Router.
r := mux.NewRouter()
fs := http.FileServer(http.Dir("../app/build/src/assets/"))
r.Handl... | package main
import (
"github.com/NYTimes/gziphandler"
"github.com/discoviking/website/server/storage"
"github.com/gorilla/mux"
"net/http"
)
func createRouter(storageService storage.Service) *mux.Router {
// Main Router.
r := mux.NewRouter()
storageHandler := storage.NewHandler(storageService)
r.Handle("/sto... | Change to using PathPrefix for general routes | Change to using PathPrefix for general routes
| Go | mit | DiscoViking/website,DiscoViking/website,DiscoViking/website,DiscoViking/website,DiscoViking/website |
d97e8262650c3cfdb3f9fd577a5861f4ef6e1d62 | boil/db.go | boil/db.go | package boil
import (
"database/sql"
"os"
)
type Executor interface {
Exec(query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) *sql.Row
}
type Transactor interface {
Commit() error
Rollback() error
Exe... | package boil
import (
"database/sql"
"os"
)
var (
// currentDB is a global database handle for the package
currentDB Executor
)
// Executor can perform SQL queries.
type Executor interface {
Exec(query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
... | Fix some documentation and ugly constant placement | Fix some documentation and ugly constant placement
| Go | bsd-3-clause | nullbio/sqlboiler,pobri19/sqlboiler,volatiletech/sqlboiler,vattle/sqlboiler,volatiletech/sqlboiler |
ec6ac3d3dd30f3e6e9d95390745c4a6a6b35d61f | src/despite/despite_test.go | src/despite/despite_test.go | package main
import (
"bytes"
"fmt"
"strings"
"testing"
)
func TestTableSizesCommand(t *testing.T) {
saved := dburi
dburi = "postgres://localhost/postgres?sslmode=disable"
var buf bytes.Buffer
// TODO set up some tables to get sizes from
err := tableSize(&buf)
dburi = saved
if err != nil {
t.Errorf(fmt.S... | package main
import (
"bytes"
"database/sql"
"fmt"
"strings"
"testing"
)
func TestTableSizesCommand(t *testing.T) {
saved := dburi
dburi = "postgres://localhost/postgres?sslmode=disable"
var buf bytes.Buffer
db, err := sql.Open("postgres", dburi)
if err != nil {
t.Errorf(fmt.Sprintf("Got error %s", err))
... | Create a test table to see size in test output. | Create a test table to see size in test output.
| Go | apache-2.0 | kindlyops/despite,kindlyops/despite,kindlyops/despite |
6d958ea13a6480d5a090d07a93f6fecb742c643a | sub/httpd/status.go | sub/httpd/status.go | package httpd
import (
"bufio"
"fmt"
"net/http"
"github.com/Symantec/Dominator/lib/html"
"github.com/Symantec/Dominator/lib/srpc"
)
func statusHandler(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.NotFound(w, req)
return
}
writer := bufio.NewWriter(w)
defer writer.Flush()
fm... | package httpd
import (
"bufio"
"fmt"
"net/http"
"github.com/Symantec/Dominator/lib/html"
"github.com/Symantec/Dominator/lib/srpc"
)
func statusHandler(w http.ResponseWriter, req *http.Request) {
html.SetSecurityHeaders(w) // Compliance checkbox.
if req.URL.Path != "/" {
http.NotFound(w, req)
return
}
wr... | Add security headers to subd HTTPD handler. | Add security headers to subd HTTPD handler.
| Go | apache-2.0 | Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator |
a2c051de357cbc7890c931051877d753aecc055a | providers.go | providers.go | package main
import (
"log"
"github.com/codegangsta/cli"
"github.com/headmade/backuper/config"
)
func providerAction(c *cli.Context) {
var providerConfig config.Provider
switch c.Command.Name {
case "AWS":
validateArgs(c, 2)
providerConfig = config.Provider{"AWS_ACCESS_KEY_ID": c.Args()[0], "AWS_SECRET_ACC... | package main
import (
"log"
"github.com/codegangsta/cli"
"github.com/headmade/backuper/config"
)
func providerAction(c *cli.Context) {
var providerConfig config.Provider
switch c.Command.Name {
case "AWS":
validateArgs(c, 3)
providerConfig = config.Provider{"bucket": c.Args()[0], "AWS_ACCESS_KEY_ID": c.Arg... | Add bucket to p command | Add bucket to p command
| Go | mit | headmade/backuper |
5ddef488663eb7557a0a4e1a2c5374cbd7a2ef0c | api/oidc.go | api/oidc.go | package api
import (
"fmt"
)
type OIDCToken struct {
Token string `json:"token"`
}
type OIDCTokenRequest struct {
JobId string
Audience string
}
func (c *Client) OIDCToken(methodReq *OIDCTokenRequest) (*OIDCToken, *Response, error) {
m := &struct {
Audience string `json:"audience,omitempty"`
}{
Audienc... | package api
import (
"fmt"
)
type OIDCToken struct {
Token string `json:"token"`
}
type OIDCTokenRequest struct {
JobId string
Audience string
}
func (c *Client) OIDCToken(methodReq *OIDCTokenRequest) (*OIDCToken, *Response, error) {
m := &struct {
Audience string `json:"audience,omitempty"`
}{
Audienc... | Change OIDCToken method to not return a nil pointer in case of error | Change OIDCToken method to not return a nil pointer in case of error
| Go | mit | buildkite/agent,buildkite/agent,buildkite/agent |
09467c2f03527b934d22f4aa49c8033f54b8a1f9 | state/service_test.go | state/service_test.go | package state
import (
"fmt"
"testing"
)
func TestServiceConsistent(t *testing.T) {
state := stateSetup(simpleServiceMeta, simpleService, t)
result := state.Consistent()
if result.Consistent != false {
fmt.Println("Detected running non-existant service: ", result.Metadata.Name)
}
fmt.Println(result.Consisten... | package state
/*
import (
"fmt"
"testing"
)
func TestServiceConsistent(t *testing.T) {
state := stateSetup(simpleServiceMeta, simpleService, t)
result := state.Consistent()
if result.Consistent != false {
fmt.Println("Detected running non-existant service: ", result.Metadata.Name)
}
fmt.Println(result.Consis... | Comment all Service tests out, not sure how to test with Travis and no init systme | Comment all Service tests out, not sure how to test with Travis and no init systme
| Go | mit | vektorlab/otter,vektorlab/otter,vektorlab/otter |
884a64f2cca73bbcf4657168833ccf9d0e610e88 | web/auth/reauth.go | web/auth/reauth.go | package auth
import (
"github.com/gin-gonic/gin"
"github.com/pufferpanel/apufferi/v4/response"
"github.com/pufferpanel/pufferpanel/v2/models"
"github.com/pufferpanel/pufferpanel/v2/services"
"github.com/pufferpanel/pufferpanel/v2/web/handlers"
"net/http"
)
func Reauth(c *gin.Context) {
db := handlers.GetDataba... | package auth
import (
"github.com/gin-gonic/gin"
"github.com/pufferpanel/apufferi/v4/response"
"github.com/pufferpanel/pufferpanel/v2/models"
"github.com/pufferpanel/pufferpanel/v2/services"
"github.com/pufferpanel/pufferpanel/v2/web/handlers"
"net/http"
)
func Reauth(c *gin.Context) {
db := handlers.GetDataba... | Build before you check in.... | Build before you check in....
| Go | apache-2.0 | PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel |
beb2d3d8748ec728684b54334ca455c6dc74ac2c | webcam/v4l2/webcam.go | webcam/v4l2/webcam.go | package v4l2
import "fmt"
// #include "webcam_wrapper.h"
import "C"
import "unsafe"
var w *C.webcam_t
func OpenWebcam(path string, width, height int) {
dev := C.CString(path)
defer C.free(unsafe.Pointer(dev))
w = C.go_open_webcam(dev, C.int(width), C.int(height))
// The following defer statement introduces a `d... | package v4l2
import (
"log"
)
// #include "webcam_wrapper.h"
import "C"
import "unsafe"
var w *C.webcam_t
func OpenWebcam(path string, width, height int) {
dev := C.CString(path)
defer C.free(unsafe.Pointer(dev))
w = C.go_open_webcam(dev, C.int(width), C.int(height))
// The following defer statement introduces... | Use log instead of fmt | Webcam: Use log instead of fmt
Signed-off-by: kfei <1da1ad03e627cea4baf20871022464fcc6a4b2c4@kfei.net>
| Go | mit | kfei/sshcam,kfei/sshcam |
a48e7020f845bc5681c9c8588d120f0d99b310e9 | utils/random_reward.go | utils/random_reward.go | package utils
import (
"crypto/rand"
"math/big"
"github.com/freeusd/solebtc/models"
)
// RandomReward generates a random reward with rates given
func RandomReward(rates []models.RewardRate) int64 {
sum := sumOfWeights(rates)
if sum < 1 {
panic("sum of reward rates weight should be greater than 0")
}
i := 0... | package utils
import (
"crypto/rand"
"math/big"
"github.com/freeusd/solebtc/models"
)
// RandomReward generates a random reward with rates given
func RandomReward(rates []models.RewardRate) int64 {
var sum int64
for i := range rates {
sum += rates[i].Weight
}
if sum < 1 {
panic("sum of reward rates weight... | Move sumOfWeights inline of RandomReward | Move sumOfWeights inline of RandomReward
| Go | mit | freeusd/solebtc,solefaucet/sole-server,freeusd/solebtc,solefaucet/sole-server,solefaucet/sole-server,freeusd/solebtc |
91423b229344b67d0e30b03e148c2807baf4ef6a | auth/auth.go | auth/auth.go | package auth
import (
"time"
"golang.org/x/net/context"
)
// AuthenticationProvider provides helper methods to convert tokens to sessions
// using our own internal authorization services
type AuthenticationProvider interface {
// RecoverSession from a given access token, converting this into a set of credentials
... | package auth
import (
"time"
"golang.org/x/net/context"
)
// AuthenticationProvider provides helper methods to convert tokens to sessions
// using our own internal authorization services
type AuthenticationProvider interface {
// RecoverSession from a given access token, converting this into a set of credentials
... | Add User and Client to the credential interface | Add User and Client to the credential interface
| Go | mit | mondough/typhon,monzo/typhon |
56096908ad6d4c41fc5956f6fd55e773ef6048b3 | cmd/bintogo/tmpl.go | cmd/bintogo/tmpl.go | package main
import (
"bufio"
"io"
"os"
"text/template"
)
const (
dataTmpl = `// This file was auto-generated.
package {{.Pkg}}
var {{.Name}}Data = [{{.Size}}]byte{
{{range .Data}} {{printf "0x%02X" .}},
{{end}}}`
)
var tmpl = new(template.Template)
func init() {
template.Must(tmpl.New("data").Parse(dataTmp... | package main
import (
"bufio"
"io"
"os"
"text/template"
)
const (
dataTmpl = `// This file was auto-generated.
package {{.Pkg}}
var {{.Name}}Data = [...]byte{
{{range .Data}} {{printf "0x%02X" .}},
{{end}}}`
)
var tmpl = new(template.Template)
func init() {
template.Must(tmpl.New("data").Parse(dataTmpl))
}
... | Remove need to get file size in advance. | cmd/bintogo: Remove need to get file size in advance.
| Go | mit | DeedleFake/incoming |
c7071dcb6fe8e95bf56f235a6945f19f53f763d8 | cmd/main.go | cmd/main.go | package main
import (
"fmt"
"github.com/yeo/betterdev.link/baja"
"log"
"os"
)
var (
Version string
GitCommit string
)
func main() {
fmt.Printf("BetterDev %s Build %s\n", Version, GitCommit)
cwd, err := os.Getwd()
if err != nil {
log.Fatal("Cannot fetch current dir", err)
return
}
log.Println(os.Ar... | package main
import (
"fmt"
"github.com/yeo/betterdev.link/baja"
"log"
"os"
)
var (
Version string
GitCommit string
)
func main() {
fmt.Printf("BetterDev %s Build %s\n", Version, GitCommit)
cwd, err := os.Getwd()
if err != nil {
log.Fatal("Cannot fetch current dir", err)
return
}
log.Println(os.Ar... | Add an alias for build | Add an alias for build
| Go | mit | yeospace/better-dev.link,yeospace/better-dev.link,yeo/betterdev.link,yeo/betterdev.link,yeo/betterdev.link,yeo/betterdev.link,yeospace/better-dev.link |
d3e7f760c83ad699117d9ff5a8408cd0236697dd | cmd/statspusher/main.go | cmd/statspusher/main.go | package main
import (
"github.com/Sirupsen/logrus"
"github.com/cerana/cerana/pkg/logrusx"
"github.com/spf13/pflag"
)
func main() {
logrus.SetFormatter(&logrusx.MistifyFormatter{})
config := newConfig(nil, nil)
pflag.Parse()
dieOnError(config.loadConfig())
dieOnError(config.setupLogging())
sp, err := newSt... | package main
import (
"github.com/Sirupsen/logrus"
"github.com/cerana/cerana/pkg/logrusx"
"github.com/spf13/pflag"
)
func main() {
logrus.SetFormatter(&logrusx.JSONFormatter{})
config := newConfig(nil, nil)
pflag.Parse()
dieOnError(config.loadConfig())
dieOnError(config.setupLogging())
sp, err := newStats... | Use logrus.JSONFormatter instead of MistifyFormatter in statspusher | Use logrus.JSONFormatter instead of MistifyFormatter in statspusher
| Go | mit | cerana/cerana,cerana/cerana,cerana/cerana,cerana/cerana |
a5bfe78f387335834f043777837f4581604fc4fe | run_test.go | run_test.go | package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"path"
)
var _ = Describe("Run", func() {
It("has a version number", func() {
Expect(version).ToNot(BeNil())
})
Describe("callerDir", func() {
It("should return the directory of this source code file in Run's implementat... | package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"path"
)
var _ = Describe("Run", func() {
It("has a version number", func() {
Expect(version).ToNot(BeNil())
})
Describe("callerDir", func() {
It("should return the directory of this source code file in Run's implementat... | Make the spec for callerDir more strict, requiring "run" to be at the end | Make the spec for callerDir more strict, requiring "run" to be at the end
| Go | mit | nicolasmccurdy/run |
bfd1fe977e1a4f921fce6b4ca522b024df0b2733 | ethutil/size_test.go | ethutil/size_test.go | package ethutil
import (
checker "gopkg.in/check.v1"
)
type SizeSuite struct{}
var _ = checker.Suite(&SizeSuite{})
func (s *SizeSuite) TestStorageSizeString(c *checker.C) {
data1 := 2381273
data2 := 2192
data3 := 12
exp1 := "2.38 mB"
exp2 := "2.19 kB"
exp3 := "12.00 B"
res1 := StorageSize(data1).String()
... | package ethutil
import (
checker "gopkg.in/check.v1"
)
type SizeSuite struct{}
var _ = checker.Suite(&SizeSuite{})
func (s *SizeSuite) TestStorageSizeString(c *checker.C) {
data1 := 2381273
data2 := 2192
data3 := 12
exp1 := "2.38 mB"
exp2 := "2.19 kB"
exp3 := "12.00 B"
c.Assert(StorageSize(data1).String()... | Update test style to checker | Update test style to checker
| Go | mit | maran/go-ethereum,maran/go-ethereum,maran/go-ethereum,maran/go-ethereum,maran/go-ethereum,maran/go-ethereum,maran/go-ethereum,maran/go-ethereum,maran/go-ethereum |
b95bf535a9f650e083836e98671ef548dc29f05c | cow_test.go | cow_test.go | package gorocksdb
import (
"sync"
"testing"
"github.com/facebookgo/ensure"
)
func TestCOWList(t *testing.T) {
cl := NewCOWList()
cl.Append("hello")
cl.Append("world")
cl.Append("!")
ensure.DeepEqual(t, cl.Get(0), "hello")
ensure.DeepEqual(t, cl.Get(1), "world")
ensure.DeepEqual(t, cl.Get(2), "!")
}
func T... | package gorocksdb
import (
"fmt"
"sync"
"testing"
"github.com/facebookgo/ensure"
)
func TestCOWList(t *testing.T) {
cl := NewCOWList()
cl.Append("hello")
cl.Append("world")
cl.Append("!")
ensure.DeepEqual(t, cl.Get(0), "hello")
ensure.DeepEqual(t, cl.Get(1), "world")
ensure.DeepEqual(t, cl.Get(2), "!")
}
... | Add benchmark test for COWList_Get | Add benchmark test for COWList_Get
| Go | mit | tecbot/gorocksdb,tecbot/gorocksdb |
6c1da37036523eafa1df7c9faafd29639c31ef71 | vm/classes/classes.go | vm/classes/classes.go | package classes
const (
ObjectClass = "Object"
ClassClass = "Class"
ModuleClass = "Module"
IntegerClass = "Integer"
FloatClass = "Float"
StringClass = "String"
ArrayClass = "Array"
HashClass = "Hash"
BooleanClass = "Boolean"
NullClass = "Null"
ChannelClass = "Channel"
R... | package classes
// A list of native classes
const (
ObjectClass = "Object"
ClassClass = "Class"
ModuleClass = "Module"
IntegerClass = "Integer"
FloatClass = "Float"
StringClass = "String"
ArrayClass = "Array"
HashClass = "Hash"
BooleanClass = "Boolean"
NullClass = "Null"
C... | Add comments to comply golint | Add comments to comply golint
| Go | mit | goby-lang/goby,st0012/Rooby,goby-lang/goby,st0012/Rooby,goby-lang/goby |
d6672b6f71ee214a72c3c1a11748aa4d4f90a97b | spec/fixtures/issue-1.go | spec/fixtures/issue-1.go | package main
import (
"fmt"
)
type test struct {
attr string
}
func main() {
fmt.Println(&test{
attr: "test",
})
}
| package main
import (
"fmt"
)
type test struct {
attr string
}
func issue1() {
fmt.Println(&test{
attr: "test",
})
}
| Fix go get on travis | Fix go get on travis
| Go | mit | wndhydrnt/go-signature-statusbar |
f9f47a8418140a0477c82c4ea9ffb0366b6815a6 | pkg/db/dai/rprojects.go | pkg/db/dai/rprojects.go | package dai
import (
r "github.com/dancannon/gorethink"
"github.com/materials-commons/mcstore/pkg/db/model"
"github.com/materials-commons/mcstore/pkg/db/schema"
)
type rProjects struct {
session *r.Session
}
func NewRProjects(session *r.Session) rProjects {
return rProjects{
session: session,
}
}
func (p rP... | package dai
import (
r "github.com/dancannon/gorethink"
"github.com/materials-commons/mcstore/pkg/db/model"
"github.com/materials-commons/mcstore/pkg/db/schema"
)
type rProjects struct {
session *r.Session
}
func NewRProjects(session *r.Session) rProjects {
return rProjects{
session: session,
}
}
func (p rP... | Use the correct index name. | Use the correct index name.
| Go | mit | materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore |
8f5a85b2a3e8ba168633ca3e7c0c4f6c26e4475a | pkg/request/response.go | pkg/request/response.go | package request
import (
"encoding/json"
"io/ioutil"
"net/http"
)
/*
*type Response interface {
* StatusCode() int
*
* Headers() http.Header
* Content() chan []byte
*
* Request() *Request
*}
*/
type Response struct {
*http.Response
}
func (r *Response) JSON(f interface{}) error {
buf, _ :=... | package request
import (
"encoding/json"
"io/ioutil"
"net/http"
)
/*
*type Response interface {
* StatusCode() int
*
* Headers() http.Header
* Content() chan []byte
*
* Request() *Request
*}
*/
type Response struct {
*http.Response
}
func (r *Response) JSON(f interface{}) error {
buf, err ... | Add error-checking to JSON unmarshaling in request pkg | Add error-checking to JSON unmarshaling in request pkg
| Go | apache-2.0 | maxamillion/flamingo,tmrts/flamingo,tmrts/flamingo,maxamillion/flamingo |
12b9a7d8217524cca54e5c333ba6624cbdb50a3f | screens/mainmapscreen.go | screens/mainmapscreen.go | package screens
import (
"groggy/world"
"github.com/nsf/termbox-go"
"groggy/widgets"
)
func MainMapLoop(worldState *world.WorldState) {
level := worldState.CurrentLevel
player := worldState.PlayerCharacter
for {
widgets.DrawMainMap(0, 2, worldState)
widgets.DrawStatusBar(0, 23, worldState)
termbox.Flush... | package screens
import (
"groggy/world"
"github.com/nsf/termbox-go"
"groggy/widgets"
)
func mainMapProcessInput(worldState *world.WorldState, event termbox.Event) {
level := worldState.CurrentLevel
player := worldState.PlayerCharacter
switch event.Key {
case termbox.KeyArrowLeft:
if player.MapEntity.X > 0 {... | Move input event processing to its own method | Move input event processing to its own method
| Go | apache-2.0 | noseblowhorn/groggy |
c0ab8fc353a472d23b7cb98366ef9d16e593725f | structs.go | structs.go | package main
import (
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
type Rules struct {
Rules []Rule
}
type Rule struct {
Description string `yaml:"description"`
EventPattern string `yaml:"event_pattern"`
Name string `yaml:"name"`
ScheduleExpres... | package main
import (
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
type Rules struct {
Rules []Rule
}
type Rule struct {
Description string `yaml:"description"`
EventPattern string `yaml:"event_pattern"`
Name string `yaml:"name"`
ScheduleExpres... | Store actual target for actual rule in rule struct | Store actual target for actual rule in rule struct
| Go | mit | unasuke/maekawa |
564adc09e4351668cf3a3914a560d94bdeb0b1a7 | internal/skeleton/routes/routes.go | internal/skeleton/routes/routes.go | package routes
import (
"net/http"
h "github.com/anonx/sunplate/internal/skeleton/assets/handlers"
r "github.com/anonx/sunplate/routing"
)
// List is a slice of routes of the following form:
// Route:
// Pattern
// Handlers:
// Method: Handler
// If using a standard router just call Context.Build() to get ht... | package routes
import (
"net/http"
h "github.com/anonx/sunplate/internal/skeleton/assets/handlers"
r "github.com/anonx/sunplate/routing"
)
// List is a slice of routes of the following form:
// Route:
// Pattern
// Handlers:
// Method: Handler
// If using a standard router just call Context.Build() to get ht... | Fix for correct serve of static files | Fix for correct serve of static files
| Go | bsd-2-clause | anonx/sunplate,goaltools/goal,anonx/sunplate,anonx/sunplate,goaltools/goal,goaltools/goal |
2717858d72b09bf82c6e596f58c96a3d6061e0cc | listener.go | listener.go | package main
import (
"log"
"net"
"time"
)
func listener(listen string, quit chan struct{}, dispatcher func(net.IP, []byte)) {
buf := make([]byte, 32765)
laddr, err := net.ResolveUDPAddr("udp", listen)
checkErr(err)
conn, err := net.ListenUDP("udp", laddr)
checkErr(err)
defer conn.Close()
log.Println("Li... | package main
import (
"log"
"net"
"time"
)
func listener(listen string, quit chan struct{}, dispatcher func(net.IP, []byte)) {
buf := make([]byte, 50000)
laddr, err := net.ResolveUDPAddr("udp", listen)
checkErr(err)
conn, err := net.ListenUDP("udp", laddr)
checkErr(err)
defer conn.Close()
log.Println("Li... | Increase buffer size and only pass as much as we received to dispatcher | Increase buffer size and only pass as much as we received to dispatcher
| Go | mit | arachnist/udproxy |
6ea3342a6ba446a5d73ab80bde427b9791596ddf | gbdxcli/cmd/util.go | gbdxcli/cmd/util.go | package cmd
import (
"os"
"path"
"runtime"
)
// ensureGBDXDir will create the gbdx directory if it doesn't already exist.
func ensureGBDXDir() (string, error) {
gbdxPath := path.Join(userHomeDir(), ".gbdx")
err := os.MkdirAll(gbdxPath, 0775)
return gbdxPath, err
}
// userHomeDir returns the home directory of t... | package cmd
import (
"os"
"path"
"runtime"
)
// ensureGBDXDir will create the gbdx directory if it doesn't already exist.
func ensureGBDXDir() (string, error) {
gbdxPath := path.Join(userHomeDir(), ".gbdx")
err := os.MkdirAll(gbdxPath, 0600)
return gbdxPath, err
}
// userHomeDir returns the home directory of t... | Make gbdx directory only read/writeable by owner. | Make gbdx directory only read/writeable by owner.
This happens on creation, if its already existing it won't change the permissions.
| Go | mit | youngpm/gbdx |
f3ecff8aefa41247f363ec006f944454bbfd7b8c | modules/api/app/model/falcon_portal/grp_host.go | modules/api/app/model/falcon_portal/grp_host.go | package falcon_portal
// +---------+------------------+------+-----+---------+-------+
// | Field | Type | Null | Key | Default | Extra |
// +---------+------------------+------+-----+---------+-------+
// | grp_id | int(10) unsigned | NO | PRI | NULL | |
// | host_id | int(11) | NO ... | package falcon_portal
import (
con "github.com/open-falcon/falcon-plus/modules/api/config"
)
// +---------+------------------+------+-----+---------+-------+
// | Field | Type | Null | Key | Default | Extra |
// +---------+------------------+------+-----+---------+-------+
// | grp_id | int(10) unsign... | Add function to judge whether host has been binded with hostgroup | [model] Add function to judge whether host has been binded with hostgroup
| Go | apache-2.0 | jojohappy/falcon-plus,taomaree/falcon-plus,jojohappy/falcon-plus,jojohappy/falcon-plus,open-falcon/falcon-plus,jojohappy/falcon-plus,jojohappy/falcon-plus,taomaree/falcon-plus,taomaree/falcon-plus,open-falcon/falcon-plus,open-falcon/falcon-plus,taomaree/falcon-plus,open-falcon/falcon-plus,jojohappy/falcon-plus,taomaree... |
f6045b9c65448252deb924ff3422fe61b8651d7f | main_test.go | main_test.go | package main
import (
"testing"
"github.com/kellydunn/golang-geo"
)
func TestGeocode(t *testing.T) {
query := "1600 amphitheatre parkway"
expectedAddress := "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"
expectedLatitude, expectedLongitude := 37.4219998, -122.0839596
result, err := geocode(query, n... | package main
import (
"testing"
"github.com/kellydunn/golang-geo"
)
func TestGeocode(t *testing.T) {
query := "1600 amphitheatre parkway"
expectedAddress := "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"
expectedLatitude, expectedLongitude := 37.4219998, -122.0839596
result, err := geocode(query, n... | Add benchmark for geocode function. | Add benchmark for geocode function.
| Go | mit | zachlatta/geodude |
d0e8147e228a7436b335ef96357582bd7080b3cc | plugins/agents/mysql/Mysql.go | plugins/agents/mysql/Mysql.go | package mysql
import (
"database/sql"
"strconv"
"github.com/gansoi/gansoi/plugins"
// We need the MySQL driver for this.
_ "github.com/go-sql-driver/mysql"
)
// MySQL retrieves metrics from a MySQL server.
type MySQL struct {
DSN string `toml:"dsn" json:"dsn" description:"Mysql DSN"`
}
func init() {
plugins... | package mysql
import (
"database/sql"
"strconv"
"github.com/gansoi/gansoi/plugins"
// We need the MySQL driver for this.
_ "github.com/go-sql-driver/mysql"
)
// MySQL retrieves metrics from a MySQL server.
type MySQL struct {
DSN string `toml:"dsn" json:"dsn" description:"Mysql DSN"`
}
func init() {
plugins... | Fix MySQL agent for broken DSN. | Fix MySQL agent for broken DSN.
| Go | mit | gansoi/gansoi,gansoi/gansoi,gansoi/gansoi,gansoi/gansoi |
2a7d0634fd7ae0eaa708e4d6fa51da4768c33717 | nvd-cli.go | nvd-cli.go | package main
import (
"fmt"
"github.com/docopt/docopt-go"
)
func main() {
usage := `Usage: nvd-search [-c CVE | -k KEY] [-v VENDOR] [-p PRODUCT] [-n NVD]
Options:
-h --help show this
-c CVE --cve CVE CVE-ID of the vulnerability [default: ]
-k KEY --key KEY keyw... | package main
import (
"fmt"
"github.com/docopt/docopt-go"
)
func main() {
usage := `Usage: nvd-search [-c CVE | -k KEY] [-v VENDOR] [-p PRODUCT] [-n NVD]
Options:
-h --help show this
-c CVE --cve CVE CVE-ID of the vulnerability [default: ]
-k KEY --key KEY keyw... | Change default location of local NVD | Change default location of local NVD
| Go | mit | okuuva/nvd-search-cli |
c2125148de79fc205f46f14712ea693e5217abf2 | lib/brain/backup_schedule.go | lib/brain/backup_schedule.go | package brain
import (
"github.com/BytemarkHosting/bytemark-client/lib/prettyprint"
"io"
)
// BackupSchedule represents a schedule to take backups on. It is represented as a start date in YYYY-MM-DD hh:mm:ss format (and assuming UK timezones of some kind.)
type BackupSchedule struct {
StartDate string
Interval i... | package brain
import (
"github.com/BytemarkHosting/bytemark-client/lib/prettyprint"
"io"
)
// BackupSchedule represents a schedule to take backups on. It is represented as a start date in YYYY-MM-DD hh:mm:ss format (and assuming UK timezones of some kind.)
type BackupSchedule struct {
StartDate string `json:"start... | Add json tags to BackupSchedule | Add json tags to BackupSchedule
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
db5deb62cd98873ab5661f7b818b5ce648f2f96b | aws/data_source_aws_billing_service_account.go | aws/data_source_aws_billing_service_account.go | package aws
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
)
// See http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-getting-started.html#step-2
var billingAccountId = "386209384616"
func dataSourceAwsBillingServiceAccount() *schema.Resource {
return &schema.Resource{
Read: da... | package aws
import (
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/hashicorp/terraform/helper/schema"
)
// See http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-getting-started.html#step-2
var billingAccountId = "386209384616"
func dataSourceAwsBillingServiceAccount() *schema.Resource {
return... | Use AWS ARN structure - aws_billing_service_account data source. | Use AWS ARN structure - aws_billing_service_account data source.
| Go | mpl-2.0 | nbaztec/terraform-provider-aws,terraform-providers/terraform-provider-aws,Ninir/terraform-provider-aws,Ninir/terraform-provider-aws,kjmkznr/terraform-provider-aws,Ninir/terraform-provider-aws,terraform-providers/terraform-provider-aws,kjmkznr/terraform-provider-aws,kjmkznr/terraform-provider-aws,terraform-providers/ter... |
a9a434a11cca06808f5ada8f8c0290e6aa13013f | linoise/linoise_test.go | linoise/linoise_test.go | // Copyright 2010 The "go-linoise" Authors
//
// Use of this source code is governed by the Simplified BSD License
// that can be found in the LICENSE file.
//
// This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License
// for more de... | // Copyright 2010 The "go-linoise" Authors
//
// Use of this source code is governed by the Simplified BSD License
// that can be found in the LICENSE file.
//
// This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License
// for more de... | Use a variable for the file in test. | Use a variable for the file in test.
| Go | bsd-2-clause | fiber/go-linoise |
e08426cc8d11465fbfdd4f71b97baf50e2a02ee4 | p2p/transport/websocket/websocket_browser.go | p2p/transport/websocket/websocket_browser.go | // +build js,wasm
package websocket
import (
"context"
"errors"
"syscall/js"
"github.com/libp2p/go-libp2p-core/transport"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
)
func (t *WebsocketTransport) maDial(ctx context.Context, raddr ma.Multiaddr) (manet.Conn, error... | // +build js,wasm
package websocket
import (
"context"
"errors"
"syscall/js"
"github.com/libp2p/go-libp2p-core/transport"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
)
func (t *WebsocketTransport) maDial(ctx context.Context, raddr ma.Multiaddr) (manet.Conn, error... | Call conn.Close if waitForOpen returns an error | Call conn.Close if waitForOpen returns an error
| Go | mit | libp2p/go-libp2p,libp2p/go-libp2p,ipfs/go-libp2p |
44874009257d4d47ba9806f1b7f72a32a015e4d8 | severity.go | severity.go | package log
import (
"fmt"
"strings"
)
type Severity int32
// Supported severities.
const (
SeverityDebug Severity = iota
SeverityInfo
SeverityWarning
SeverityError
)
var severityNames = []string{"DEBUG", "INFO", "WARN", "ERROR"}
func (s Severity) String() string {
return severityNames[s]
}
func SeverityFr... | package log
import (
"fmt"
"strings"
)
type Severity int32
// Supported severities.
const (
SeverityDebug Severity = iota
SeverityInfo
SeverityWarning
SeverityError
)
var severityNames = []string{"DEBUG", "INFO", "WARN", "ERROR"}
func (s Severity) String() string {
if int(s) < 0 || int(s) >= len(severityNam... | Add bounds check to Severity.String() | Add bounds check to Severity.String()
| Go | apache-2.0 | mailgun/log |
c39f8f49d89ec69f51ede724d28337a00e25ee74 | pkg/util/password.go | pkg/util/password.go | /*
* Copyright 2019, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package util
import (
"crypto/rand"
"math/big"
)
var (
PossibleCharacters = []rune("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + ";:_,.-#+... | /*
* Copyright 2019, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package util
import (
"crypto/rand"
"math/big"
)
var (
PossibleCharacters = []rune("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + ";:,.-_="... | Remove some of the special characters | Remove some of the special characters | Go | apache-2.0 | EnMasseProject/enmasse,EnMasseProject/enmasse,jenmalloy/enmasse,jenmalloy/enmasse,EnMasseProject/enmasse,jenmalloy/enmasse,jenmalloy/enmasse,EnMasseProject/enmasse,jenmalloy/enmasse,jenmalloy/enmasse,EnMasseProject/enmasse,EnMasseProject/enmasse,EnMasseProject/enmasse,jenmalloy/enmasse |
7505cfa0538d05a52c70ebb7a8f844d9887ac9dc | test/fixedbugs/bug026.go | test/fixedbugs/bug026.go | // $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 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 main
export Vector;
type Element interface {
}
type Vector struct {
}
func (v *Vector) Insert(i int, e Eleme... | // $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 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 main
type Element interface {
}
export type Vector struct {
}
func (v *Vector) Insert(i int, e Element) {
}
... | Change old-style export declaration to new style export of type definition. | Change old-style export declaration to new style export of
type definition.
R=r
DELTA=3 (0 added, 2 deleted, 1 changed)
OCL=16537
CL=16545
| Go | bsd-3-clause | bdwalton/debian-golang,wesolows/golang,bdwalton/debian-golang,wesolows/golang,pombredanne/go-deleteme,wesolows/golang-old,gnanderson/go,apparentlymart/golang,wesolows/golang-old,dsriram/golang,wesolows/golang,dsriram/golang,pombredanne/go-deleteme,apparentlymart/golang,firebitsbr/golang-old,bdwalton/debian-golang,pombr... |
d60a660683c1a9068b16790950504a18a7a71773 | required_export_test.go | required_export_test.go | package validator
var (
ConvertToConcreteValue = convertToConcreteValue
GetFieldByName = getFieldByName
IsValid = isValid
)
| package validator
var (
ConvertToConcreteValue = convertToConcreteValue
GetFieldByName = getFieldByName
IsValid = isValid
IsPresentArray = isPresentArray
IsPresentString = isPresentString
IsPresentStruct = isPresentStruct
)
| Add export variable for test | Add export variable for test
| Go | mit | go-jstmpl/go-jsvalidator |
be4820f6eb79c89eb0ee62cf93619eb2c7f004fd | pkg/api/handlers/update_cluster.go | pkg/api/handlers/update_cluster.go | package handlers
import (
"github.com/go-openapi/runtime/middleware"
"github.com/sapcc/kubernikus/pkg/api"
"github.com/sapcc/kubernikus/pkg/api/models"
"github.com/sapcc/kubernikus/pkg/api/rest/operations"
"github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
fun... | package handlers
import (
"github.com/go-openapi/runtime/middleware"
"github.com/sapcc/kubernikus/pkg/api"
"github.com/sapcc/kubernikus/pkg/api/models"
"github.com/sapcc/kubernikus/pkg/api/rest/operations"
"github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
fun... | Return resource on PUT /api/v1/clusters/:name | Return resource on PUT /api/v1/clusters/:name
| Go | apache-2.0 | sapcc/kubernikus,sapcc/kubernikus,sapcc/kubernikus |
eeeefc3d70c4a0c56530b1a18b4efdfb98cc86ee | go/logger/rotatelog.go | go/logger/rotatelog.go | // Copyright 2016 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package logger
import (
"errors"
"time"
)
// RotateLogFile is the old style of logging to a file. It uses a default
// config for log rotation and uses the filename set from .Configure.
func (lo... | // Copyright 2016 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package logger
import (
"errors"
"time"
)
// RotateLogFile is the old style of logging to a file. It uses a default
// config for log rotation and uses the filename set from .Configure.
func (lo... | Change client to delete permanently old log files | logger: Change client to delete permanently old log files
| Go | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client |
c0fae23a9c73645dc82bc52c9783bd01e8c26c65 | pkg/apis/pipeline/controller.go | pkg/apis/pipeline/controller.go | /*
Copyright 2019 The Tekton 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, softw... | /*
Copyright 2019 The Tekton 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, softw... | Update comment on RunControllerName const | Update comment on RunControllerName const
Prior to this commit the code comment for the `RunControllerName` const actually desribed the PipelineRun controller name.
This commit updates the code comment to correctly document the custom task controller name. | Go | apache-2.0 | tektoncd/pipeline,tektoncd/pipeline |
d0ea5d5f730c5136152f99f05268b899b65ef4ff | filesystem_windows_test.go | filesystem_windows_test.go | // +build windows
package gps
import (
"os/exec"
"testing"
)
// setupUsingJunctions inflates fs onto the host file system, but uses Windows
// directory junctions for links.
func (fs filesystemState) setupUsingJunctions(t *testing.T) {
fs.setupDirs(t)
fs.setupFiles(t)
fs.setupJunctions(t)
}
func (fs filesystem... | // +build windows
package gps
import (
"os/exec"
"testing"
)
// setupUsingJunctions inflates fs onto the host file system, but uses Windows
// directory junctions for links.
func (fs filesystemState) setupUsingJunctions(t *testing.T) {
fs.setupDirs(t)
fs.setupFiles(t)
fs.setupJunctions(t)
}
func (fs filesystem... | Create junction to an absolute path | Create junction to an absolute path
| Go | bsd-3-clause | ibrasho-forks/dep,golang/dep,ibrasho-forks/dep,golang/dep,golang/dep |
ea566c371cd6ba85b02a6fe7ae9c4e23d5698bde | go/discovery/metric.go | go/discovery/metric.go | /*
Copyright 2017 Simon J Mudd
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 wr... | /*
Copyright 2017 Simon J Mudd
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 wr... | Remove MetricsEqual() as not used | Remove MetricsEqual() as not used
| Go | apache-2.0 | github/orchestrator,enisoc/orchestrator,github/orchestrator,orkestrov/orchestrator,orkestrov/orchestrator,github/orchestrator,enisoc/orchestrator,orkestrov/orchestrator,enisoc/orchestrator,orkestrov/orchestrator,github/orchestrator,enisoc/orchestrator |
282662ffb010760a64847917071e1c0bbcd8c014 | hw.go | hw.go | //Command to run test version:
//goapp serve app.yaml
//Command to deploy/update application:
//goapp deploy -application golangnode0 -version 0
package main
import (
"fmt"
"net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World!")
}
func startPage(w http.ResponseWriter... | //Command to run test version:
//goapp serve app.yaml
//Command to deploy/update application:
//goapp deploy -application golangnode0 -version 0
package main
import (
"fmt"
"net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World!")
}
func startPage(w http.ResponseWriter... | Correct version for deploy to GAE | Correct version for deploy to GAE
| Go | mit | GreyLabsDev/GoTests,GreyLabsDev/GoTests |
e9c1f8c005129e9a882689da4c16c23406e5b2e5 | hashfns.go | hashfns.go | package gash
// a collection of various hash function implementations.
// a simple djb2 implementation
func Djb2(s string) int {
hash := 5381
for c := range s {
hash += (hash * 33) + c
}
return hash
}
| package gash
// a collection of various hash function implementations.
// a simple djb2 implementation
func Djb2(s string) int {
hash := 5381
for _, c := range s {
hash += (hash * 33) + int(c)
}
return hash
}
| Fix hash function to actually hash by character value | Fix hash function to actually hash by character value
| Go | mit | elvinyung/gash |
aa1f6a1c3c53e721f4ee29ab286cd669240183ff | cmd/chdir.go | cmd/chdir.go | package cmd
import (
"os"
"path/filepath"
"github.com/gsamokovarov/jump/cli"
"github.com/gsamokovarov/jump/config"
"github.com/gsamokovarov/jump/scoring"
)
func updateCmd(args cli.Args, conf *config.Config) {
dir, err := os.Getwd()
if len(args) == 0 && err != nil {
cli.Exitf(1, "err: %s\n", err)
} else {
... | package cmd
import (
"os"
"path/filepath"
"github.com/gsamokovarov/jump/cli"
"github.com/gsamokovarov/jump/config"
"github.com/gsamokovarov/jump/scoring"
)
func updateCmd(args cli.Args, conf *config.Config) {
dir, err := os.Getwd()
if len(args) == 0 && err != nil {
cli.Exitf(1, "err: %s\n", err)
} else {
... | Fix a typo in jump --help | Fix a typo in jump --help
Closes #3. Thanks to stephen-a-ingram for the heads up.
| Go | mit | gsamokovarov/jump |
1785a143eaf435002f020c07e39f11dc81edd385 | version.go | version.go | // GENERATED and MANAGED by giddyup (https://github.com/alexandre-normand/giddyup)
package slackscot
const (
VERSION = "3.2.1"
)
| // GENERATED and MANAGED by giddyup (https://github.com/alexandre-normand/giddyup)
package slackscot
const (
VERSION = "1.0.0"
)
| Revert to Version 1.0.0 prior to Go Module Upgrade | Revert to Version 1.0.0 prior to Go Module Upgrade
Not great to ignore all previous version bumps but since youppi
is the only user, that is the time to do it
| Go | mit | alexandre-normand/slackscot |
82799507bd1117dfa8b56aaf22a85b139a9e798c | ui/UpdateProgressPane.go | ui/UpdateProgressPane.go | package ui
import (
"image"
"image/draw"
"github.com/ninjasphere/go-gestic"
"github.com/ninjasphere/sphere-go-led-controller/util"
)
type UpdateProgressPane struct {
progressImage util.Image
loopingImage util.Image
progress float64
}
func NewUpdateProgressPane(progressImage string, loopingImage string)... | package ui
import (
"image"
"image/color"
"image/draw"
"github.com/ninjasphere/go-gestic"
"github.com/ninjasphere/sphere-go-led-controller/util"
)
type UpdateProgressPane struct {
progressImage util.Image
loopingImage util.Image
progress float64
}
func NewUpdateProgressPane(progressImage string, loopi... | Fix update progress pane with correct overlay method | Fix update progress pane with correct overlay method
| Go | mit | ninjasphere/sphere-go-led-controller,ninjasphere/sphere-go-led-controller,ninjasphere/sphere-go-led-controller,ninjasphere/sphere-go-led-controller,lindsaymarkward/sphere-go-led-controller,lindsaymarkward/sphere-go-led-controller,lindsaymarkward/sphere-go-led-controller,lindsaymarkward/sphere-go-led-controller |
39e5ec5be6017b0737c799644d9f6665ee262292 | cmd/juju/plugin_test.go | cmd/juju/plugin_test.go | package main
import (
. "launchpad.net/gocheck"
)
type PluginSuite struct {
}
var _ = Suite(&PluginSuite{})
func (*PluginSuite) TestFindPlugins(c *C) {
plugins := findPlugins()
c.Assert(plugins, DeepEquals, []string{})
}
| package main
import (
"os"
. "launchpad.net/gocheck"
"launchpad.net/juju-core/testing"
)
type PluginSuite struct {
oldPath string
home *testing.FakeHome
}
var _ = Suite(&PluginSuite{})
func (suite *PluginSuite) SetUpTest(c *C) {
suite.oldPath = os.Getenv("PATH")
suite.home = testing.MakeEmptyFakeHome(c)
... | Isolate the check for plugins from the actual plugins the test runner may have. | Isolate the check for plugins from the actual plugins the test runner may have. | Go | agpl-3.0 | bz2/juju,mikemccracken/juju,cloud-green/juju,anastasiamac/juju,tasdomas/juju,perrito666/juju,mattyw/juju,mhilton/juju,howbazaar/juju,cherylj/juju,alesstimec/juju,marcoceppi/juju,dimitern/juju,axw/juju,waigani/juju,kat-co/juju,makyo/juju,axw/juju,dimitern/juju,macgreagoir/juju,mhilton/juju-juju,Altoros/juju-vmware,cloud... |
1494c72b84a86c4778f238d7181a93107c0137e0 | main_unix.go | main_unix.go | // +build linux
package main
import (
"os"
"runtime"
"github.com/opencontainers/runc/libcontainer"
_ "github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/urfave/cli"
)
func init() {
if len(os.Args) > 1 && os.Args[1] == "init" {
runtime.GOMAXPROCS(1)
runtime.LockOSThread()
}
}
var initComman... | // +build linux
package main
import (
"os"
"runtime"
"github.com/opencontainers/runc/libcontainer"
_ "github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/urfave/cli"
)
func init() {
if len(os.Args) > 1 && os.Args[1] == "init" {
runtime.GOMAXPROCS(1)
runtime.LockOSThread()
}
}
var initComman... | Add error return to action function signature | Add error return to action function signature
Not having an error return is deprecated
Signed-off-by: Mrunal Patel <d389837b018b67489df74a2c5f0aca13aaed44b6@gmail.com>
| Go | apache-2.0 | dqminh/runc,mYmNeo/runc,docker/runc,justincormack/runc,sunyuan3/runc,shishir-a412ed/runc,xiaochenshen/runc,nkwilson/runc,opencontainers/runc,justincormack/runc,mheon/runc,justincormack/runc,wking/runc,cyphar/runc,WeiZhang555/runc,coolljt0725/runc,mYmNeo/runc,cyphar/runc,estesp/runc,maxamillion/runc,avagin/runc,mYmNeo/r... |
a18141bd8c9c5e5c07ded69c0df3172ef885faac | instance.go | instance.go | package jupiterbrain
type Instance struct {
ID string `json:"id"`
IPAddresses []string `json:"ip_addresses"`
State string `json:"state"`
}
| package jupiterbrain
type Instance struct {
ID string
IPAddresses []string
State string
}
| Remove JSON tags on Instance struct in root package | Remove JSON tags on Instance struct in root package
The names of the JSON fields is a task for the server subpackage, where
it is defined.
| Go | mit | Tiger66639/jupiter-brain,Tiger66639/jupiter-brain,travis-ci/jupiter-brain,travis-ci/jupiter-brain |
21b4f45a47a9f96601c215ff21242ff3a880a561 | pkg/svrconf/svrconf.go | pkg/svrconf/svrconf.go | package svrconf
type ServerConfig struct {
Code string `json:"code,omitempty"`
CodeDir string `json:"codeDir,omitempty"`
Image string `json:"image,omitempty"`
Ports []int `json:"ports,omitempty"`
Updated int64 `json:"updated,omitempty"`
Version string `json:"version,omitempty"`
}
| package svrconf
type ServerConfig struct {
Code string `json:"code,omitempty"`
CodeDir string `json:"codeDir,omitempty"`
Image string `json:"image,omitempty"`
Ports []int `json:"ports,omitempty"`
Updated int64 `json:"updated,omitempty"`
Version string `json:"version,o... | Add additional fields to serverconfig struct. | Add additional fields to serverconfig struct.
| Go | mpl-2.0 | mobingi/mobingi-cli |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.