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 |
|---|---|---|---|---|---|---|---|---|---|
c86eb9feb8ef92596c20edacc94e1d8c98338f4b | taskmanager/taskmanager.go | taskmanager/taskmanager.go | package taskmanager
// TaskManager ...
// A TaskManager contains functions for dealing with RabbitMQ methods
// and APIs. Both `MasterManager` and `JobManager` implement the methods in
// this interface
type TaskManager interface {
Consume(string) (map[string]interface{}, error)
ShouldRespond() bool
StartA... | package taskmanager
// TaskManager ...
// A TaskManager contains functions for dealing with RabbitMQ methods
// and APIs. Both `MasterManager` and `JobManager` implement the methods in
// this interface
type TaskManager interface {
Consume(string) (map[string]interface{}, error)
}
| Simplify TaskManager interface to smallest footprint | Simplify TaskManager interface to smallest footprint
| Go | mit | jspc/workflow-engine,gincorp/gin,gincorp/gin |
863a9fc3cd9215aa3894aba43ae452e7e5f384f0 | client/reply_test.go | client/reply_test.go | package client
import (
"bytes"
"testing"
)
func TestBytes(t *testing.T) {
r := client.Cmd("get", "k").Bytes()
if !bytes.Equal(r, []byte("v")) {
t.Logf("expect bytes [% #x], but get[ % #x]\n", []byte("v"), r)
t.Fail()
}
}
| package client
import (
"bytes"
"testing"
)
func TestBytes(t *testing.T) {
r := client.Cmd("get", "k").Bytes()
if !bytes.Equal(r, []byte("v")) {
t.Logf("expect bytes [% #x], but get[ % #x]\n", []byte("v"), r)
t.Fail()
}
}
func TestString(t *testing.T) {
r := client.Cmd("get", "k").String()
if r != "v" {... | Add test case for reply String method. | Add test case for reply String method.
| Go | mit | kofj/redlot |
5b824940c9f7180694289e00fe0e0419782651e3 | testing/storebench/write_test.go | testing/storebench/write_test.go | package storebench
import (
"io/ioutil"
"log"
"os"
"strconv"
"testing"
"github.com/skyec/astore"
blobs "github.com/skyec/astore/testing"
)
var benchStore astore.WriteableStore
var benchDir string
func init() {
}
func BenchmarkDefaultWrite(b *testing.B) {
benchDir, err := ioutil.TempDir("", "astore-benchmark... | package storebench
import (
"io/ioutil"
"log"
"os"
"strconv"
"testing"
"github.com/skyec/astore"
blobs "github.com/skyec/astore/testing"
)
var benchStore astore.WriteableStore
var benchDir string
func init() {
file, err := os.OpenFile("test.log", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
... | Test both all unique keys and common keys cases | Test both all unique keys and common keys cases
also redirect any `log` output to a file to keep the benchmarking stats
clean
| Go | mit | skyec/astore |
949b59607ba26cdf2ab1d740265005d1d02b42ad | main.go | main.go | package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"github.com/vandosant/commandeer/models"
)
var commands models.Commands
func CommandHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/vnd.application+json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
c :... | package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"github.com/vandosant/commandeer/models"
)
var commands models.Commands
func CommandHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/vnd.application+json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
c :... | Use literal for Command struct | Use literal for Command struct
| Go | mit | vandosant/commandeer |
f1e4952e73bd1951b30578baff86eed808ae478c | main.go | main.go | // Copyright © 2017 Martin Lindner <mlindner@gaba.co.jp>
//
// 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, mo... | // Copyright © 2017 Martin Lindner <mlindner@gaba.co.jp>
//
// 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, mo... | Change import path to github.com. | Change import path to github.com.
| Go | mit | martinlindner/go-vtm-cli |
c5aa15a221bdb624019312994a2a92e91a4e6ba4 | main.go | main.go | package main
import (
"fmt"
"log"
"net/http"
"os"
_ "github.com/noxoin/golink/server"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
log.Printf("Defaulting to port %s", port)
}
http.HandleFunc("/_ah/health", healthCheckHandler)
log.Printf("Server listening on port %s", port)
l... | package main
import (
"fmt"
"log"
"net/http"
"os"
_ "github.com/Noxoin/golink/server"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
log.Printf("Defaulting to port %s", port)
}
http.HandleFunc("/_ah/health", healthCheckHandler)
log.Printf("Server listening on port %s", port)
l... | Update import case in url | Update import case in url
| Go | apache-2.0 | Noxoin/golink,Noxoin/golink,Noxoin/golink |
dbd69c59b81ec72258da35a335605e4b3ea17e6a | tc_linux.go | tc_linux.go | package console
import (
"fmt"
"os"
"unsafe"
"golang.org/x/sys/unix"
)
const (
cmdTcGet = unix.TCGETS
cmdTcSet = unix.TCSETS
)
func ioctl(fd, flag, data uintptr) error {
if _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, flag, data); err != 0 {
return err
}
return nil
}
// unlockpt unlocks the slave pseud... | package console
import (
"fmt"
"os"
"unsafe"
"golang.org/x/sys/unix"
)
const (
cmdTcGet = unix.TCGETS
cmdTcSet = unix.TCSETS
)
// unlockpt unlocks the slave pseudoterminal device corresponding to the master pseudoterminal referred to by f.
// unlockpt should be called before opening the slave side of a pty.
f... | Fix ptsname() for big-endian architectures | Fix ptsname() for big-endian architectures
On big-endian architectures unix.IoctlGetInt() leads to a wrong result
because a 32 bit value is stored into a 64 bit buffer. When dereferencing
the result is left shifted by 32. Without this patch ptsname() returns
a wrong path from the second pty onwards.
To protect syscall... | Go | apache-2.0 | containerd/console |
82578cf9b5e2dc4f6acb6320454b99165ee04652 | tokengen.go | tokengen.go | package osin
import (
"encoding/base64"
"strings"
"code.google.com/p/go-uuid/uuid"
)
// AuthorizeTokenGenDefault is the default authorization token generator
type AuthorizeTokenGenDefault struct {
}
func removePadding(token string) string {
return strings.TrimRight(token, "=")
}
// GenerateAuthorizeToken gener... | package osin
import (
"encoding/base64"
"strings"
"code.google.com/p/go-uuid/uuid"
)
// AuthorizeTokenGenDefault is the default authorization token generator
type AuthorizeTokenGenDefault struct {
}
func removePadding(token string) string {
return strings.TrimRight(token, "=")
}
// GenerateAuthorizeToken gener... | Use NewRandom instead of NewUUID | Use NewRandom instead of NewUUID
NewUUID is based on a timestamp, while NewRandom
is based on a PRNG, like it should be.
| Go | bsd-3-clause | arekkas/osin,RangelReale/osin,jonnyreeves/osin,agtorre/osin,gogap/oauth2,paytm/osin,observadorpt/osin,outrightmental/go-osin,lonelycode/osin,lancecarlson/osin,Inflatablewoman/osin,helojo/osin,DejaMi/osin,girirajsharma/osin,ahmet/osin,Iceyer/osin,oyediyildiz/osin,hoysoft/osin,liggitt/osin,go-osin/osin,gpndata/osin,airon... |
ff9e934df8529175014958473741e08ac6650943 | page.go | page.go | package dskvs
import (
"sync"
)
type page struct {
isDirty bool
isDeleted bool
basepath string
coll string
key string
value []byte
sync.RWMutex
}
func newPage(basepath, coll, key string) *page {
return &page{
isDirty: false,
isDeleted: false,
basepath: basepath,
coll: coll,... | package dskvs
import (
"sync"
)
type page struct {
isDirty bool
isDeleted bool
basepath string
coll string
key string
value []byte
sync.RWMutex
}
func newPage(basepath, coll, key string) *page {
return &page{
isDirty: false,
isDeleted: false,
basepath: basepath,
coll: coll,... | Test pass... at a high performance cost... =,( | Test pass... at a high performance cost... =,(
| Go | mit | aybabtme/dskvs,aybabtme/dskvs,aybabtme/dskvs |
c4148b88831348a44b678990b79f463881a6828a | mockgen/tests/vendor_dep/doc.go | mockgen/tests/vendor_dep/doc.go | package vendor_dep
//go:generate mockgen -package vendor_dep -destination mock.go github.com/golang/mock/mockgen/tests/vendor_dep VendorsDep
| package vendor_dep
//go:generate mockgen -package vendor_dep -destination mock.go github.com/golang/mock/mockgen/tests/vendor_dep VendorsDep
//go:generate mockgen -destination source_mock_package/mock.go -source=vendor_dep.go
| Add a (failing) test case for using source mode to mock something that depends on a vendored package. | Add a (failing) test case for using source mode to mock something that depends on a vendored package.
| Go | apache-2.0 | golang/mock,golang/mock |
a94db1aa4f4e0a668a7264f6b480b113d3cf814e | lib/editor/main.go | lib/editor/main.go | package editor
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
)
func Open(editorCommand string, fileName, helperText string, removeSharps bool) (text string, err error) {
filePath := fmt.Sprintf("%s/%s", os.TempDir(), fileName)
tmpFile, err := os.Create(filePath)
if err != nil {
return
}
... | package editor
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
)
// Open the specified editor
/* Parameters:
* editorCommand
* fileName: the name of the temporary file
* helperText: a text to be inserted on the file to be edited
* removeSharps: a boolean to remove or not any line starting with ... | Fix a bug when removeSharp was false | Fix a bug when removeSharp was false
| Go | mit | gumieri/act |
a9587fb60e15796ee9360edd2cc692fe80642486 | handler/map.go | handler/map.go | package handler
import (
"github.com/materials-commons/config/cfg"
)
type mapHandler struct {
values map[string]interface{}
}
func Map() cfg.Handler {
return &mapHandler{values: make(map[string]interface{})}
}
func (h *mapHandler) Init() error {
return nil
}
func (h *mapHandler) Get(key string, args ...interfa... | package handler
import (
"github.com/materials-commons/config/cfg"
)
type mapHandler struct {
values map[string]interface{}
}
// Map creates a handler that stores all values in a hashmap. It is commonly used
// as a component to build more complex handlers.
func Map() cfg.Handler {
return &mapHandler{values: make... | Add comments to the Map handler. | Add comments to the Map handler.
| Go | mit | materials-commons/config,materials-commons/config |
2078a83634ecc93097dad5a189537b39d59116f5 | invdendpoint/emails.go | invdendpoint/emails.go | package invdendpoint
type EmailRequest struct {
To []EmailDetail `json:"to,omitempty"`
Bcc string `json:"bcc,omitempty"`
Subject string `json:"subject,omitempty"`
Message string `json:"message,omitempty"`
Template string `json:"template,omitempty"`
Type string ... | package invdendpoint
type EmailRequest struct {
To []EmailDetail `json:"to,omitempty"`
Bcc string `json:"bcc,omitempty"`
Subject string `json:"subject,omitempty"`
Message string `json:"message,omitempty"`
Template string `json:"template,omitempty"`
Type string ... | Make sure email response id is interface{} | Make sure email response id is interface{}
| Go | mit | Invoiced/go-invoiced-api,Invoiced/invoiced-go,Invoiced/invdapi |
d6237f789da65556a587d8ab7a250e9fed934add | landoblog/landoblog.go | landoblog/landoblog.go | // Copyright 2013 Landon Wainwright. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Starts up the blog system using the default values
package main
import (
"flag"
"github.com/landonia/simplegoblog/blog"
"log"
"os"
)
// Starts a new... | // Copyright 2013 Landon Wainwright. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Starts up the blog system using the default values
package main
import (
"flag"
"github.com/landonia/simplegoblog/blog"
"log"
"os"
)
// Starts a new... | Change to address instead of port | Change to address instead of port
| Go | bsd-3-clause | landonia/landotube,landonia/landotube |
cea25ab53ab4a49be3048ef99b1aa5b91116b00d | libkbfs/version.go | libkbfs/version.go | package libkbfs
// Current version (should be MAJOR.MINOR.PATCH)
const Version = "1.0.0"
// Build
const Build = "21"
| package libkbfs
// Current version (should be MAJOR.MINOR.PATCH)
const Version = "1.0.0"
// Build
const Build = "22"
| Increment build number (testing release scripts) | Increment build number (testing release scripts)
| Go | bsd-3-clause | keybase/client,keybase/kbfs,keybase/client,keybase/client,keybase/client,keybase/kbfs,keybase/kbfs,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/kbfs |
52ceb9fbc6674c9fa4f409d989b9b8c832e1aed7 | main.go | main.go | package main
import (
"github.com/go-martini/martini"
)
func main() {
m := martini.Classic()
m.Get("/.*", martini.Static(""))
m.Run()
}
| package main
import (
"os"
"os/exec"
// "log"
// "fmt"
"strings"
"runtime"
// "strconv" // For Itoa
// "encoding/csv"
"encoding/json"
"github.com/go-martini/martini"
)
func main() {
m := martini.Classic()
// CPU count
m.Get("/sh/numberofcores.php", func () ([]byte,... | Add some basic functions hostname, ps, etc ... | Add some basic functions hostname, ps, etc ...
| Go | apache-2.0 | AaronO/dashd,AaronO/dashd |
80e5a2ca5170370cd2f0e334498f154a9ccfd4ea | main.go | main.go | package main
import (
"fmt"
"github.com/codegangsta/cli"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "docker-inject"
app.Usage = "Copy files/directories from hosts to running Docker containers"
app.Version = "0.0.0"
app.Action = func(c *cli.Context) {
inj, err := newInjector(os.Stderr, c.Args())
i... | package main
import (
"fmt"
"github.com/codegangsta/cli"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "docker-inject"
app.Usage = "Copy files/directories from hosts to running Docker containers"
app.Version = "0.0.0"
app.HideHelp = true
app.Flags = []cli.Flag{
cli.HelpFlag,
}
app.Action = func(c *... | Disable the default 'help' subcommand | Disable the default 'help' subcommand
| Go | mit | y-taka-23/docker-inject |
a32b275cd52ed6736ad93b7f8ce3b08360423b11 | main.go | main.go | package main
import (
"io/ioutil"
"net/http"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func pasteHandler(w http.ResponseWriter, req *http.Request) {
buf, _ := ioutil.ReadAll(req.Body)
paste := buf[89 : len(buf)-46]
err := ioutil.WriteFile("/tmp/dat1", paste, 0644)
check(err)
}
func main() {
http... | package main
import (
"fmt"
"github.com/dchest/uniuri"
"io/ioutil"
"net/http"
"os"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func exists(location string) bool {
if _, err := os.Stat(location); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
}
func generateName() string... | Fix up minor bugs and add more features | Fix up minor bugs and add more features
| Go | mit | ewhal/Pastebin,patchon/Pastebin,ewhal/Pastebin,patchon/Pastebin,patchon/Pastebin,ewhal/Pastebin |
2ef130c031d1e946b6517650a69d674114e7e30a | main.go | main.go | package main
import (
"flag"
"fmt"
"os"
)
var output string
func init() {
flag.Usage = func() {
fmt.Printf("Usage: %s [-out=out.path] in.path\n\n", os.Args[0])
flag.PrintDefaults()
}
flag.StringVar(&output, "out", "out.go", "Specify a path to the output file")
flag.Parse()
}
func main() {
checkRequire... | package main
import (
"flag"
"fmt"
"os"
)
var output string
func init() {
flag.Usage = func() {
fmt.Printf("Usage: %s [-out=out.path] in.path\n\n", os.Args[0])
flag.PrintDefaults()
}
flag.StringVar(&output, "out", "out.go", "Specify a path to the output file")
flag.Parse()
}
func main() {
checkRequire... | Add input file presence check | Add input file presence check
| Go | mit | konjoot/go-inspect |
369668ecdd6a291766a5ed274258cef3636ef9cd | main.go | main.go | package main
import (
"github.com/danryan/hal"
_ "github.com/danryan/hal/adapter/shell"
_ "github.com/danryan/hal/adapter/slack"
_ "github.com/danryan/hal/store/memory"
"os"
)
var canYouHandler = hal.Hear("(Tim|tim).*can you.*", func(res *hal.Response) error {
return res.Send("on it!")
})
var echoHandler = hal... | package main
import (
"fmt"
"github.com/danryan/hal"
_ "github.com/danryan/hal/adapter/slack"
_ "github.com/danryan/hal/store/memory"
"os"
)
var canYouHandler = hal.Hear("(Tim|tim).*can you.*", func(res *hal.Response) error {
return res.Send("on it!")
})
var karmaHandler = hal.Hear(".*(\\w+)(\\+\\+|\\-\\-).*",... | Add Draft of Karma Handler. | Add Draft of Karma Handler.
| Go | mit | alexandre-normand/everytimisawesome |
5b4fae30f46a0004e9b6fec5abc2807a9d7c043e | main.go | main.go | package main
import (
"encoding/json"
"log"
"net/http"
"os"
"cjdavis.me/elysium/services"
)
func main() {
http.HandleFunc("/", handler)
port := os.Getenv("PORT")
if port == "" {
port = "9090"
}
log.Printf("Elysium listening on port %s", port)
http.ListenAndServe(":"+port, nil)
}
func handler(w http.R... | package main
import (
"encoding/json"
"log"
"net/http"
"os"
"github.com/julienschmidt/httprouter"
"cjdavis.me/elysium/services"
)
func main() {
router := httprouter.New()
router.GET("/", handler)
port := os.Getenv("PORT")
if port == "" {
port = "9090"
}
log.Printf("Elysium listening on port %s", por... | Use Julien Schmidt's http router | Use Julien Schmidt's http router
| Go | mit | Crevax/Elysium |
499b0f3d071dbc6f95a8194e190146721d85e191 | main.go | main.go | package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
)
var (
// exitCode to terminate.
exitCode = 0
)
func main() {
os.Exit(realMain())
}
func realMain() int {
app := cli.NewApp()
app.Name = "air"
app.Version = Version
app.Usage = "Command-line AirPlay client for Apple TV"
app.Author = "Tomohir... | package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
)
var (
// exitCode to terminate.
exitCode = 0
)
func main() {
os.Exit(realMain())
}
func realMain() int {
app := cli.NewApp()
app.Name = "air"
app.Version = Version
app.Usage = "Command-line AirPlay client for Apple TV"
app.Author = "Tomohir... | Use `paths` instead of `path` | Use `paths` instead of `path`
| Go | mit | Tomohiro/air |
32daf238e1f3ceb63b590198648a81a6cd56048b | test_helpers/database_config.go | test_helpers/database_config.go | package test_helpers
import "github.com/pivotal-cf-experimental/cf-mysql-quota-enforcer/database"
func NewRootDatabaseConfig(dbName string) database.Config {
return database.Config{
Host: "127.0.0.1",
Port: 3306,
User: "root",
Password: "password",
DBName: dbName,
}
}
| package test_helpers
import (
"os"
"github.com/pivotal-cf-experimental/cf-mysql-quota-enforcer/config"
"github.com/pivotal-cf-experimental/cf-mysql-quota-enforcer/database"
)
func NewRootDatabaseConfig(dbName string) database.Config {
configPath := os.Getenv("CONFIG")
if configPath == "" {
panic("CONFIG path ... | Load same config in test as in main. | Load same config in test as in main.
[#88665590]
| Go | apache-2.0 | pivotal-cf-experimental/cf-mysql-quota-enforcer,pivotal-cf-experimental/cf-mysql-quota-enforcer |
3c96d0b863bcf562484c8e32f8a0b3d38d29e189 | solver/llbsolver/file/user_nolinux.go | solver/llbsolver/file/user_nolinux.go | // +build !linux
package file
import (
"github.com/moby/buildkit/solver/llbsolver/ops/fileoptypes"
"github.com/moby/buildkit/solver/pb"
"github.com/pkg/errors"
copy "github.com/tonistiigi/fsutil/copy"
)
func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.User, error) {
return nil, errors.New("onl... | // +build !linux
package file
import (
"github.com/moby/buildkit/solver/llbsolver/ops/fileoptypes"
"github.com/moby/buildkit/solver/pb"
"github.com/pkg/errors"
copy "github.com/tonistiigi/fsutil/copy"
)
func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.User, error) {
if chopt == nil {
return ... | Support not chowning files on all platforms | Support not chowning files on all platforms
Signed-off-by: Paul "TBBle" Hampson <220d126b3d70d9d7b0fda508e4cb236265bccc41@Pobox.com>
| Go | apache-2.0 | tonistiigi/buildkit_poc,tonistiigi/buildkit_poc |
3bc9a312bbe1324487589cc739a901996206206f | rtptransceiver.go | rtptransceiver.go | package webrtc
import (
"github.com/pkg/errors"
)
// RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid.
type RTPTransceiver struct {
Mid string
Sender *RTPSender
Receiver *RTPReceiver
Direction RTPTransceiverDirection
// currentDirection RTPTransceiverD... | package webrtc
import (
"fmt"
"github.com/pkg/errors"
)
// RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid.
type RTPTransceiver struct {
Mid string
Sender *RTPSender
Receiver *RTPReceiver
Direction RTPTransceiverDirection
// currentDirection RTPTran... | Check Sender.track assigning for nil | Check Sender.track assigning for nil
It does not make sense to have Sender.track == nil
| Go | mit | pion/webrtc,pion/webrtc,pion/webrtc,pion/webrtc |
fa01586706b15056e707065d9b5ab9a1fa3392ab | util.go | util.go | package main
import (
"runtime"
"os"
"os/exec"
"strings"
)
func MakeSymbolicLink(link, target string) {
var cmd *exec.Cmd
switch runtime.GOOS {
case "windows":
cmd = exec.Command("cmd.exe", "/c", strings.Join([]string{"mklink", "/d", link, target}, " "))
default:
cmd = exec.Command("ln", "-s", target, lin... | package main
import (
"runtime"
"os"
"os/exec"
"strings"
)
func MakeSymbolicLink(link, target string) {
var cmd *exec.Cmd
switch runtime.GOOS {
case "windows":
cmd = exec.Command("powershell", "-Command", "Start-Process cmd -ArgumentList\"/c," + strings.Join([]string{"mklink", "/d", link, target + "\" -Verb ... | Use some... magic for create symbolic link on windows | Use some... magic for create symbolic link on windows
| Go | mit | Perlmint/goautoenv |
83d1dd042e8cc2fd916aba6d51c19a33fe14893d | main.go | main.go | package main
import (
"flag"
"go/build"
"log"
"math/rand"
"time"
"github.com/esimov/diagram/canvas"
"github.com/esimov/diagram/io"
"github.com/esimov/diagram/ui"
"github.com/fogleman/imview"
)
var defaultFontFile = build.Default.GOPATH + "/src/github.com/esimov/diagram" + "/font/gloriahallelujah.ttf"
var (... | package main
import (
"flag"
"go/build"
"log"
"math/rand"
"time"
"github.com/esimov/diagram/canvas"
"github.com/esimov/diagram/io"
"github.com/esimov/diagram/ui"
"github.com/fogleman/imview"
)
var defaultFontFile = build.Default.GOPATH + "/src/github.com/esimov/diagram" + "/font/gloriahallelujah.ttf"
var (... | Add CLI flag to allow not showing the preview window | Add CLI flag to allow not showing the preview window
| Go | mit | esimov/diagram,esimov/diagram |
8caf9e14cfc4df8be2b1b0a413ce50aa2aac0f5f | main.go | main.go | package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/ayoisaiah/stellar-photos-server/routes"
"github.com/joho/godotenv"
"github.com/rs/cors"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
port := fmt.Sprintf(":%v", os.Getenv("PORT"))
mux := rou... | package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/ayoisaiah/stellar-photos-server/routes"
"github.com/joho/godotenv"
"github.com/rs/cors"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Println("File .env not found, reading configuration from ENV")
}
port := fmt.Sprintf(":%v", o... | Read config from ENV instead of crashing | Read config from ENV instead of crashing
| Go | mit | ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos |
22c25f1179571e5f3b06ff0de9bd5b19d6dbd372 | main.go | main.go | package main
import (
"flag"
"fmt"
"github.com/cristianoliveira/ergo/commands"
"github.com/cristianoliveira/ergo/proxy"
"os"
)
const VERSION = "0.0.4"
const USAGE = `
Ergo proxy.
The local proxy agent for multiple services development.
Usage:
ergo [options]
ergo run [options]
ergo list
Options:
-h ... | package main
import (
"flag"
"fmt"
"github.com/cristianoliveira/ergo/commands"
"github.com/cristianoliveira/ergo/proxy"
"os"
)
const VERSION = "0.0.4"
const USAGE = `
Ergo proxy.
The local proxy agent for multiple services development.
Usage:
ergo [options]
ergo run [options]
ergo list
Options:
-h ... | Add default case and fix help/version flag | fix: Add default case and fix help/version flag
| Go | mit | cristianoliveira/ergo,cristianoliveira/ergo,cristianoliveira/ergo |
3d00a8e97e44b1a8264ac2b8f4fb0a6f0f83f067 | main.go | main.go | package main
import (
// standard pkgs
"fmt"
"html/template"
"log"
"net/http"
// non standard pkgs
"github.com/bpdp/configo"
)
func handler(w http.ResponseWriter, req *http.Request) {
t, err := template.ParseFiles("templates/default.tpl")
if err != nil {
log.Fatal(err)
}
type Person struct {
Name ... | package main
import (
// standard pkgs
"fmt"
"html/template"
"log"
"net/http"
// non standard pkgs
"github.com/bpdp/configo"
)
type Config struct {
Title string
Port string
}
func handler(w http.ResponseWriter, req *http.Request) {
t, err := template.ParseFiles("templates/default.tpl")
if err != nil ... | Adjust with the latest Configo | Adjust with the latest Configo
| Go | epl-1.0 | bpdp/lunatis |
e13cc606eddc90c9f975bac441444b4384beea4a | dockerfile/dockerfile_suite_test.go | dockerfile/dockerfile_suite_test.go | package dockerfile_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestDockerfileutils(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Dockerfileutils Suite")
}
| package dockerfile_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestDockerfileutils(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Dockerfile Suite")
}
| Correct suite name for dockerfile package | Correct suite name for dockerfile package
| Go | apache-2.0 | CloudCredo/cloudrocker,agilemobiledev/cloudfocker,CloudCredo/cloudrocker,CloudCredo/cloudrocker,CloudCredo/cloudrocker,CloudCredo/cloudrocker,CloudCredo/cloudrocker,agilemobiledev/cloudfocker,agilemobiledev/cloudfocker,CloudCredo/cloudrocker,agilemobiledev/cloudfocker,agilemobiledev/cloudfocker,CloudCredo/cloudrocker,a... |
6105e4fac9aa214dca91c0b77403d54f047567b2 | config_test.go | config_test.go | package veneur
import (
"os"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestReadConfig(t *testing.T) {
exampleConfig, err := os.Open("example.yaml")
assert.NoError(t, err)
defer exampleConfig.Close()
c, err := readConfig(exampleConfig)
if err != nil {
t.Fatal(err)
}
assert... | package veneur
import (
"os"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestReadConfig(t *testing.T) {
exampleConfig, err := os.Open("example.yaml")
assert.NoError(t, err)
defer exampleConfig.Close()
c, err := readConfig(exampleConfig)
if err != nil {
t.Fatal(err)
}
assert... | Add test for trace address parsing in config | Add test for trace address parsing in config
| Go | mit | gphat/veneur,gphat/veneur,evanj/veneur,evanj/veneur,stripe/veneur,gphat/veneur,stripe/veneur,evanj/veneur |
25e72fe46f2a38bd5ae368da14b7bbd9994d722d | src/client/client.go | src/client/client.go | package datamanclient
import (
"context"
"time"
"github.com/jacksontj/dataman/src/query"
)
// TODO: support per-query config?
// TODO support switching config in-flight? If so then we'll need to store a
// pointer to it in the context -- which would require implementing one ourself
type Client struct {
Transport... | package datamanclient
import (
"context"
"time"
"github.com/jacksontj/dataman/src/query"
)
// TODO: support per-query config?
// TODO support switching config in-flight? If so then we'll need to store a
// pointer to it in the context -- which would require implementing one ourself
type Client struct {
Transport... | Add some more clarification in the docs | Add some more clarification in the docs
| Go | mit | jacksontj/dataman |
1d2eec1084c16165f49add5975e2e52c286e8daa | leetcode/345_reverse_vowels_of_a_string.go | leetcode/345_reverse_vowels_of_a_string.go | package leetcode
// 345. Reverse Vowels of a String
func reverseVowels(s string) string {
res := make([]byte, 0)
vowels := make([]byte, 0)
for i := 0; i < len(s); i++ {
switch b := s[i]; b {
case 'a', 'i', 'u', 'e', 'o', 'A', 'I', 'U', 'E', 'O':
vowels = append(vowels, b)
}
}
for i, k := 0, len(vowels)-... | package leetcode
// 345. Reverse Vowels of a String
func reverseVowels(s string) string {
res := make([]byte, len(s))
copy(res, s)
vowels := map[byte]bool{'a': true, 'i': true, 'u': true, 'e': true, 'o': true, 'A': true, 'I': true, 'U': true, 'E': true, 'O': true}
for i, k := 0, len(s)-1; i < k; {
for i < k {
... | Fix 345. Reverse Vowels of a String to use two pointers | Fix 345. Reverse Vowels of a String to use two pointers
| Go | mit | motomux/go-algo |
e4d2e040f8436ddc8cb5bfa13e9358712fecec04 | main.go | main.go | package main
import (
"github.com/codegangsta/negroni"
"github.com/digital-ocean-service/interfaces"
"github.com/digital-ocean-service/usecases"
"github.com/gorilla/mux"
)
func main() {
doInteractor := usecases.DOInteractor{}
handler := interfaces.WebServiceHandler{
Interactor: doInteractor,
ID: ... | package main
import (
"bytes"
"flag"
"fmt"
"github.com/codegangsta/negroni"
"github.com/digital-ocean-service/infraestructure"
"github.com/digital-ocean-service/interfaces"
"github.com/digital-ocean-service/usecases"
"github.com/gorilla/mux"
)
const defaultPath = "/etc/digital-ocean-service.conf"
var confFi... | Read Dependencies and inject them | Read Dependencies and inject them
- Create a default route
- Create a flag to customize the route of conf file
- Build the port string
| Go | mit | Tinker-Ware/digital-ocean-service,Infrastructure-Solutions/digital-ocean-service |
b65ac55033c46ddbd453560e388ea3a9747b85c6 | frontend/fontawesome/fontawesome.go | frontend/fontawesome/fontawesome.go | // Package fontawesome defines template assets and functions for
// using fontawesome (see http://fontawesome.io).
//
// Importing this package registers a template asset with the following
// format:
//
// fontawesome:<version>
//
// Where version is the Font Awesome version you want to use.
//
// Additionally, this ... | // Package fontawesome defines template assets and functions for
// using fontawesome (see http://fontawesome.io).
//
// Importing this package registers a template asset with the following
// format:
//
// fontawesome:<version>
//
// Where version is the Font Awesome version you want to use.
//
// Additionally, this ... | Fix import path for semver package | Fix import path for semver package
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
7b938e859b4bc267e96f8c4ef63627bfed2288ca | pump.go | pump.go | package medtronic
import (
"github.com/ecc1/cc1100"
)
type Pump struct {
Radio *cc1100.Radio
DecodingErrors int
CrcErrors int
}
func Open() (*Pump, error) {
r, err := cc1100.Open()
if err != nil {
return nil, err
}
err = r.Init()
if err != nil {
return nil, err
}
return &Pump{Radio: r}, nil
}
| package medtronic
import (
"fmt"
"log"
"os"
"github.com/ecc1/cc1100"
)
const (
freqEnvVar = "MEDTRONIC_FREQUENCY"
)
type Pump struct {
Radio *cc1100.Radio
DecodingErrors int
CrcErrors int
}
func Open() (*Pump, error) {
r, err := cc1100.Open()
if err != nil {
return nil, err
}
err = r.Init()
if... | Allow frequency to be set via MEDTRONIC_FREQUENCY environment variable | Allow frequency to be set via MEDTRONIC_FREQUENCY environment variable
| Go | mit | ecc1/medtronic,ecc1/medtronic |
7010948e20cdc2b4eaa971ae711fd3b8ef2355af | compression/main.go | compression/main.go | package main
import "fmt"
import "strconv"
func main() {
test := "aaabbbccbddd"
result := compress(test)
fmt.Println(result)
}
func compress(uncompressed string) string {
prev := 0
var letter string
var next string
var compressed string
for index := 1; index < len(uncompressed); index++ {
letter = string(u... | package compress
import "bytes"
import "strconv"
func compress(uncompressed string) string {
var buf bytes.Buffer
switch len(uncompressed) {
case 0:
break
case 1:
buf.WriteByte(uncompressed[0])
buf.WriteString("1")
default:
var prev byte
var letter byte
last := 0
for i := 1; i < len(uncompressed);... | Use case statement to cover all cases | Use case statement to cover all cases
| Go | apache-2.0 | armiller/puzzles,armiller/puzzles |
53c82c2ac9337b7fe4994758159df5abc01657a3 | src/piece/piece.go | src/piece/piece.go | package piece
import (
"chessboard"
"point"
)
type Piece struct {
movable []point.Point
white byte
black byte
}
func NewPiece(movable []point.Point, white, black byte) *Piece {
piece := new(Piece)
piece.movable = movable
piece.white = white
piece.black = black
return piece
}
func (piece Piece) CanMove... | package piece
import "point"
type Piece struct {
movable []point.Point
white byte
black byte
}
func NewPiece(movable []point.Point, white, black byte) *Piece {
piece := new(Piece)
piece.movable = movable
piece.white = white
piece.black = black
return piece
}
func (piece Piece) CanMove(diff point.Point) ... | Replace CanMove's arguments with diff | Replace CanMove's arguments with diff
| Go | mit | Roadagain/Chess |
f04e44fad7786d9cfaef4cd7d2dbe408abb80293 | test/gosrv_test.go | test/gosrv_test.go | // Copyright 2012-2013 Apcera Inc. All rights reserved.
package test
import (
"runtime"
"testing"
"time"
)
func TestSimpleGoServerShutdown(t *testing.T) {
base := runtime.NumGoroutine()
s := RunDefaultServer()
s.Shutdown()
time.Sleep(10 * time.Millisecond)
delta := (runtime.NumGoroutine() - base)
if delta >... | // Copyright 2012-2013 Apcera Inc. All rights reserved.
package test
import (
"runtime"
"testing"
"time"
)
func TestSimpleGoServerShutdown(t *testing.T) {
base := runtime.NumGoroutine()
s := RunDefaultServer()
s.Shutdown()
time.Sleep(10 * time.Millisecond)
delta := (runtime.NumGoroutine() - base)
if delta >... | Allow more time for goroutines to exit | Allow more time for goroutines to exit
| Go | apache-2.0 | ericpromislow/gnatsd,wallyqs/gnatsd,glycerine/hnatsd,brkt/gnatsd,nats-io/gnatsd,apcera/gnatsd,tylertreat/gnatsd,glycerine/hnatsd,brkt/gnatsd,mitghi/gnatsd,glycerine/gnatsd,tylertreat/gnatsd,wallyqs/gnatsd,nats-io/gnatsd,glycerine/hnatsd,apcera/gnatsd,zquestz/gnatsd,zquestz/gnatsd,mitghi/gnatsd,glycerine/gnatsd,ericprom... |
94599faddf4921e2ad53ffe47755b4b89ebd3a41 | aws/ec2/availability_zone_retriever.go | aws/ec2/availability_zone_retriever.go | package ec2
import (
"errors"
goaws "github.com/aws/aws-sdk-go/aws"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
)
type AvailabilityZoneRetriever struct {
ec2ClientProvider ec2ClientProvider
}
func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever {
return Availabili... | package ec2
import (
"errors"
goaws "github.com/aws/aws-sdk-go/aws"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
)
type AvailabilityZoneRetriever struct {
ec2ClientProvider ec2ClientProvider
}
func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever {
return Availabili... | Fix bbl up for AWS | Fix bbl up for AWS
- Different calls to AWS return different lists of availability zones
- Short-term fix ignores the az that is not returned by cloudformation
call
[#139857703]
| Go | apache-2.0 | niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader |
91a8fc22ba247b57c243ab90b49049fb734c47c3 | expweight.go | expweight.go | package onlinestats
// From http://queue.acm.org/detail.cfm?id=2534976
import "math"
type ExpWeight struct {
n int
m1 float64
v float64
alpha float64
}
func NewExpWeight(alpha float64) *ExpWeight {
return &ExpWeight{alpha: alpha}
}
func (e *ExpWeight) Push(x float64) {
if e.n == 0 {
e.m1 = x
... | package onlinestats
// From http://queue.acm.org/detail.cfm?id=2534976
import "math"
type ExpWeight struct {
n int
m1 float64
v float64
alpha float64
}
func NewExpWeight(alpha float64) *ExpWeight {
return &ExpWeight{alpha: alpha}
}
func (e *ExpWeight) Push(x float64) {
if e.n == 0 {
e.m1 = x
... | Fix online expoentially weighted variance calculation | Fix online expoentially weighted variance calculation
Transcription error from the original article.
Fixes #2
| Go | mit | dgryski/go-onlinestats |
435b63ff092f54d7a7739d2010345bb917d0fbfc | bot/router.go | bot/router.go | package bot
import (
"github.com/graffic/wanon/telegram"
)
// RouteNothing do nothing in handling
const RouteNothing = 0
const (
// RouteAccept handle the message
RouteAccept = 1 << iota
// RouteStop stop handling more messages after this one
RouteStop
)
// Handler pairs a check and a handle function
type Handl... | package bot
import "github.com/graffic/wanon/telegram"
// RouteNothing do nothing in handling
const RouteNothing = 0
const (
// RouteAccept handle the message
RouteAccept = 1 << iota
// RouteStop stop handling more messages after this one
RouteStop
)
// Message from the telegram router
type Message struct {
*te... | Use bot messages instead of telegram in handler | Use bot messages instead of telegram in handler
| Go | bsd-3-clause | graffic/wanon |
0ffb77da6e1d1eb8873e70aa081ac3bbffd8dd6f | environs/maas/environprovider.go | environs/maas/environprovider.go | package maas
import (
"launchpad.net/juju-core/environs"
"launchpad.net/juju-core/environs/config"
"launchpad.net/juju-core/log"
)
type maasEnvironProvider struct{}
var _ environs.EnvironProvider = (*maasEnvironProvider)(nil)
var providerInstance maasEnvironProvider
func init() {
environs.RegisterProvider("maa... | package maas
import (
"launchpad.net/juju-core/environs"
"launchpad.net/juju-core/environs/config"
"launchpad.net/juju-core/log"
)
type maasEnvironProvider struct{}
var _ environs.EnvironProvider = (*maasEnvironProvider)(nil)
var providerInstance maasEnvironProvider
func init() {
environs.RegisterProvider("maa... | Add BoilerplateConfig method that was added to API while we were implementing. | [author=jtv][r=rvb] Add BoilerplateConfig method that was added to API while we were implementing. | Go | agpl-3.0 | dimitern/juju,AdamIsrael/juju,axw/juju,anastasiamac/juju,macgreagoir/juju,bz2/juju,macgreagoir/juju,sinzui/juju,mikemccracken/juju,gabriel-samfira/juju,frankban/juju-tmp,ericsnowcurrently/juju,mikemccracken/juju,waigani/juju,marcoceppi/juju,bac/juju,waigani/juju,bz2/juju,alesstimec/juju,bogdanteleaga/juju,mattyw/juju,a... |
34a6a1ad69faf1a581cdba64cf7fd36f7f55f49e | pkg/cmd/list_test.go | pkg/cmd/list_test.go | package cmd
import (
"bytes"
// "io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.Error("Unexpected error result with no arguments")
}
}
func TestListWrongNumberArgs(t *testing.T) {
... | package cmd
import (
"bytes"
"io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
// Setup
originalBasePath := basePath
dir, _ := ioutil.TempDir("", "test")
basePath = dir
// Test
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.E... | Add temporary basePath for tests. | Add temporary basePath for tests.
| Go | apache-2.0 | ClusterHQ/dvol,ClusterHQ/dvol,ClusterHQ/dvol |
e1816c099e0c8c19cd8cf51ea2237d27caf528ae | main.go | main.go | package main
import (
"os"
"runtime"
"strings"
. "gist.github.com/7480523.git"
. "gist.github.com/7651991.git"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
reduceFunc := func(in string) (string, bool) {
if x := SomethingFromImportPath(in); x != nil {
Standard := x.Bpkg.Goroot && x.Bpkg.ImportPat... | package main
import (
"os"
"runtime"
"strings"
. "gist.github.com/7480523.git"
. "gist.github.com/7651991.git"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
reduceFunc := func(in string) interface{} {
if x := SomethingFromImportPath(in); x != nil {
Standard := x.Bpkg.Goroot && x.Bpkg.ImportPath !... | Use new interface of GoReduceLinesFromReader(). | Use new interface of GoReduceLinesFromReader().
| Go | mit | shurcooL/gostatus |
8cfb81140ced435e94761b9af29c4529fd76880e | main.go | main.go | package main
import (
"log"
"net/http"
)
func main() {
router := NewRouter()
log.Fatal(http.ListenAndServe(":8080", router))
}
| package main
import (
"log"
"net/http"
)
func main() {
router := NewRouter()
log.Fatal(http.ListenAndServe(":80", router))
}
| Change to run on port 80 | Change to run on port 80
| Go | mit | bjschafer/easy-notifier |
410ff68df0b32f3bafdcbb74e7e95cb799f04a28 | main.go | main.go | package main
import (
"fmt"
"net/http"
_ "net/http/pprof" // import for side effects
"encoding/json"
"github.com/gorilla/mux"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/hello/{name}", helloHandler)
r.HandleFunc("/add_job", jobHandler)
http.Handle("/", r)
http.ListenAndServe(":8080", nil)
}
func ... | package main
import (
"fmt"
"net/http"
_ "net/http/pprof" // import for side effects
"encoding/json"
"github.com/gorilla/mux"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/hello/{name}", helloHandler)
r.HandleFunc("/add_job", jobHandler)
http.Handle("/", r)
http.ListenAndServe(":8080", nil)
}
func ... | Augment /add_job to take list of email addresses | Augment /add_job to take list of email addresses
| Go | mit | hack4impact/transcribe4all,hack4impact/transcribe4all,hack4impact/transcribe4all,hack4impact/audio-transcription-service |
20e01dae8dbd8b4be4af7b22b243e79d81e7c853 | main.go | main.go | package main
import (
"github.com/kataras/iris"
"github.com/tappsi/airbrake-webhook/webhook"
)
func main() {
api := iris.New()
api.Post("/airbrake-webhook", webhook.Process)
api.Listen(":8080")
}
| package main
import (
"os"
"fmt"
"runtime"
"syscall"
"os/signal"
"github.com/kataras/iris"
"github.com/tappsi/airbrake-webhook/webhook"
)
func main() {
api := iris.New()
api.Post("/airbrake-webhook", webhook.Process)
go cleanup()
api.Listen(":8080")
}
func cleanup() {
sigChan := make(chan os.Signal)
... | Add cleanup logic when shutting down service | Add cleanup logic when shutting down service
| Go | mit | oscar-lopez/airbrake-webhook,tappsi/airbrake-webhook |
17aa2ea5fbef831866c00afeea2419576985e6a3 | main.go | main.go | package main
import (
"log"
"net"
"github.com/paultag/go-dictd/database"
"github.com/paultag/go-dictd/dictd"
)
func main() {
server := dictd.NewServer("pault.ag")
server.RegisterDatabase(&database.FnordDatabase{}, "test")
link, err := net.Listen("tcp", ":2017")
if err != nil {
log.Fatal(err)
}
for {
... | package main
import (
"log"
"net"
"github.com/paultag/go-dictd/database"
"github.com/paultag/go-dictd/dictd"
)
func main() {
server := dictd.NewServer("pault.ag")
levelDB, err := database.NewLevelDBDatabase("/home/tag/jargon.leveldb", "jargon file")
if err != nil {
log.Fatal(err)
}
server.RegisterDataba... | Add in stub'd jargon file | Add in stub'd jargon file
| Go | mit | paultag/go-dictd |
d8dbf7a4c3c518c47be5f4c8fc7ce5e982462c50 | harbour.go | harbour.go | // harbour project main.go
package main
import (
"fmt"
"os"
"os/exec"
"github.com/huawei-openlab/harbour/mflag"
"github.com/huawei-openlab/harbour/opts"
"github.com/Sirupsen/logrus"
)
func main() {
mflag.Parse()
if *flVersion {
showVersion()
return
}
if *flHelp {
mflag.Usage()
return
}
if *fl... | // harbour project main.go
package main
import (
"fmt"
"os"
"os/exec"
"github.com/huawei-openlab/harbour/mflag"
"github.com/huawei-openlab/harbour/opts"
"github.com/Sirupsen/logrus"
)
func main() {
mflag.Parse()
if *flVersion {
showVersion()
return
}
if *flHelp {
mflag.Usage()
return
}
if *fl... | Print help info if no flag specified | Print help info if no flag specified
| Go | mit | huawei-openlab/harbour |
35bd112788f0624bd66105f5630bc0423bcb0805 | conn.go | conn.go | package pooly
import (
"net"
"time"
)
// Conn abstracts user connections that are part of a Pool.
type Conn struct {
iface interface{}
timer *time.Timer
closed bool
}
// Create a new connection container, wrapping up a user defined connection object.
func NewConn(i interface{}) *Conn {
return &Conn{iface: i}... | package pooly
import (
"net"
"time"
)
// Conn abstracts user connections that are part of a Pool.
type Conn struct {
iface interface{}
timer *time.Timer
closed bool
}
// Create a new connection container, wrapping up a user defined connection object.
func NewConn(i interface{}) *Conn {
return &Conn{iface: i}... | Check for nil timer pointer | Check for nil timer pointer
| Go | bsd-3-clause | 0intro/pooly,3XX0/pooly |
364922c69c21fadc6eb770194dd6e5815dc7e53f | main.go | main.go | package main
import (
"fmt"
"log"
"os/exec"
"strings"
"github.com/PuerkitoBio/goquery"
)
func main() {
locationId := 13168
doc, err := goquery.NewDocument(fmt.Sprintf("http://trimet.org/arrivals/small/tracker?locationID=%d", locationId))
if err != nil {
log.Fatal(err)
}
title := fmt.Sprintf("Bus Stop - ... | package main
import (
"flag"
"fmt"
"log"
"os/exec"
"strings"
"github.com/PuerkitoBio/goquery"
)
func main() {
growl := flag.Bool("growl", false, "whether to use growl notifications")
flag.Parse()
locationId := 13168
doc, err := goquery.NewDocument(fmt.Sprintf("http://trimet.org/arrivals/small/tracker?loca... | Add flag to control growl notifications | Add flag to control growl notifications
| Go | apache-2.0 | thecarlhall/busstop |
89c231525d32930e7368c324ac80597dc64ff353 | main.go | main.go | package main
import (
"fmt"
"log"
"os"
)
func main() {
mode := ""
if len(os.Args) > 1 {
mode = os.Args[1]
if len(os.Args) > 2 {
os.Args = append(os.Args[:1], os.Args[2:]...)
} else {
os.Args = os.Args[0:1]
}
} else {
usage()
}
// Subcommands may override this.
log.SetOutput(os.Stderr)
swi... | package main
import (
"fmt"
"log"
"os"
)
func main() {
mode := ""
if len(os.Args) > 1 {
mode = os.Args[1]
if len(os.Args) > 2 {
os.Args = append(os.Args[:1], os.Args[2:]...)
} else {
os.Args = os.Args[0:1]
}
} else {
usage()
}
// Subcommands may override this.
log.SetOutput(os.Stderr)
swi... | Update usage string with "path" subcommand. | Update usage string with "path" subcommand.
| Go | mit | hut8labs/kerouac,hut8labs/kerouac |
3407b0d8714b06084af37013d3cc72d7ae57a541 | nsqhandler_test.go | nsqhandler_test.go | package nsqhandler
import (
"testing"
)
func TestNew(t *testing.T) {
fakePublish := func(topic string, body []byte) error {
return nil
}
handler := New(fakePublish)
if handler == nil {
t.Fatal("Expected *Handler, got nil")
}
}
| package nsqhandler
import (
"testing"
)
func TestNew(t *testing.T) {
called := false
fakePublish := func(topic string, body []byte) error {
called = true
return nil
}
handler := New(fakePublish)
if handler == nil {
t.Fatal("Expected *Handler, got nil")
}
if handler.pfunc == nil {
t.Fatal("Expected pfu... | Test the handler stored the correct publish function. | Test the handler stored the correct publish function.
| Go | bsd-3-clause | avct/apexovernsq |
6205608474a3637d975e8fa4313a78d7e4db51ad | chunkmasks.go | chunkmasks.go | package main
type ChunkMask interface {
IsMasked(x, z int) bool
}
type RectangeChunkMask struct {
x0, z0, x1, z1 int
}
func (m *RectangeChunkMask) IsMasked(x, z int) bool {
return x <= m.x0 || x > m.x1 || z <= m.z0 || z > m.z1
}
type AllChunksMask struct{}
func (m *AllChunksMask) IsMasked(x, z int) bool {
retu... | package main
type ChunkMask interface {
IsMasked(x, z int) bool
}
type RectangeChunkMask struct {
x0, z0, x1, z1 int
}
func (m *RectangeChunkMask) IsMasked(x, z int) bool {
return x < m.x0 || x >= m.x1 || z < m.z0 || z >= m.z1
}
type AllChunksMask struct{}
func (m *AllChunksMask) IsMasked(x, z int) bool {
retu... | Fix bug: square not centered on -cx -cz (off by one) | Fix bug: square not centered on -cx -cz (off by one)
| Go | bsd-2-clause | quag/mcobj,quag/mcobj |
76789307c9cf489907521ce3de0c06279db84029 | main.go | main.go | package main
import (
_ "expvar"
"fmt"
"github.com/codegangsta/negroni"
"net/http"
)
func main() {
Run()
}
func Run() {
m := http.DefaultServeMux
m.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Welcome to the home page!")
})
n := negroni.Classic()
n.UseHandler(m)
n.R... | package main
import (
_ "expvar"
"fmt"
"github.com/codegangsta/negroni"
"github.com/meatballhat/negroni-logrus"
"net/http"
)
func main() {
Run()
}
func Run() {
m := http.DefaultServeMux
m.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Welcome to the home page!")
})
n :... | Add logrus middleware for better logging | Add logrus middleware for better logging
Logrus can provide us with:
- JSON log output
- Log levels
- Airbrake/Errbit integration
...but for now, it simply provides prettier output on stdout.
Note the changes to the way I invoke Negroni:
- I use `negroni.New()` rather than `negroni.Classic()` (which acts as a
wr... | Go | mit | mattbostock/leavediary |
5ee04dc2c275ebd756d0b98796f947979ef110f4 | heal/healer.go | heal/healer.go | // Copyright 2013 tsuru 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 heal provides an interface for heal anything.
package heal
import "fmt"
// Healer represents a healer.
type Healer interface {
// NeedsHeal verifie... | // Copyright 2013 tsuru 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 heal provides an interface for heal anything.
package heal
import "fmt"
// Healer represents a healer.
type Healer interface {
// Heal heals someth... | Remove method NeedsHeal from the Healer interface. | Remove method NeedsHeal from the Healer interface.
| Go | bsd-3-clause | kgrvamsi/tsuru,mderaldo/tsuru,firebitsbr/tsuru,hugoantunes/tsuru,kgrvamsi/tsuru,tuxmonteiro/tsuru,tsuru/tsuru,Endika/tsuru,cezarsa/tsuru,tsuru/tsuru,ggarnier/tsuru,ggarnier/tsuru,RichardKnop/tsuru,tuxmonteiro/tsuru,RichardKnop/tsuru,mderaldo/tsuru,4eek/tsuru,Endika/tsuru,cgvarela/tsuru,mderaldo/tsuru,hcxiong/tsuru,gwmo... |
4713703d0743deb32a5cf24061de7c0238948a5a | wrap.go | wrap.go | package wrap
import "strings"
// Line will wrap a single line of text at the given length.
// If limit is less than 1, the string remains unchanged.
//
// If a word is longer than the given limit, it will not be broken to fit.
// See the examples for this scenario.
func Line(s string, limit int) string {
if limit < ... | package wrap
import "strings"
const (
// breakpoints defines which characters should be able to break a line.
breakpoints = " "
)
// Line will wrap a single line of text at the given length.
// If limit is less than 1, the string remains unchanged.
//
// If a word is longer than the given limit, it will not be bro... | Improve comments and add breakpoint const | Improve comments and add breakpoint const
| Go | mit | bbrks/wrap |
fb881d4ebd787939b3dc88a6788fb4a6f0fd8645 | json.go | json.go | /*
Copyright 2016 Paolo Galeone. All right 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 applicable law or agreed to i... | /*
Copyright 2016 Paolo Galeone. All right 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 applicable law or agreed to i... | Handle nil value in JSON.Scan | Handle nil value in JSON.Scan
| Go | apache-2.0 | galeone/igor |
b34f14b4ecf41e131b3da3b7044a027be4a23603 | main.go | main.go | package main
import (
"fmt"
"log"
"time"
"autotcpdump/parser"
"autotcpdump/executer"
"autotcpdump/checker"
)
func main() {
config := parser.ConfigParser{}
if err := config.Parse("config/config.json"); err != nil {
log.Fatal(err)
}
if err := checker.CheckIfPathWritable(config.PcapLocation); err != nil {
... | package main
import (
"fmt"
"log"
"os"
"time"
"strings"
"autotcpdump/parser"
"autotcpdump/executer"
"autotcpdump/checker"
)
func main() {
cmdlineArgs := os.Args[1:]
config := parser.ConfigParser{}
if err := config.Parse("config/config.json"); err != nil {
log.Fatal(err)
}
if err := checker.CheckIfPat... | Allow passing of command line arguments to tcpdump | Allow passing of command line arguments to tcpdump
| Go | mit | zulhilmizainuddin/autotcpdump |
9262c5b32f99d677b6878984e35dbd6a5b31fbd8 | main.go | main.go | // Copyright 2015 The Hugo Authors. 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 applicable ... | // Copyright 2015 The Hugo Authors. 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 applicable ... | Exit -1 on ERROR in non-global logger | Exit -1 on ERROR in non-global logger
Fixes #3239
| Go | apache-2.0 | fedelibre/hugo,gohugoio/hugo,gohugoio/hugo,anthonyfok/hugo,anthonyfok/hugo,mdhender/hugo,mdhender/hugo,fedelibre/hugo,digitalcraftsman/hugo,mitchchn/hugo,fedelibre/hugo,anthonyfok/hugo,fedelibre/hugo,digitalcraftsman/hugo,mdhender/hugo,mitchchn/hugo,mdhender/hugo,gohugoio/hugo |
1a3cf365e54522885174df94e163d3e42ba4fb0b | main.go | main.go | // tgotop project main.go
package main
import (
// proc "github.com/cespare/goproc"
ui "github.com/gizak/termui"
tm "github.com/nsf/termbox-go"
// "time"
)
func main() {
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
//getting ready to close stuff on command
evt := make(chan tm.Event)
go... | // tgotop project main.go
package main
import (
ui "github.com/gizak/termui"
tm "github.com/nsf/termbox-go"
// "time"
)
func main() {
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
qMess := ui.NewPar(":PRESS q TO QUIT")
qMess.Height = 3
//getting ready to close stuff on command
evt := m... | Exit message: for now, high on the top, will change. | Exit message: for now, high on the top, will change.
Next step: memory status
| Go | mit | NHOrus/tgotop |
3fa16d4655d3043ba9d864eca2b428d481f11ffa | plug.go | plug.go | package main
import "math/rand"
import "time"
const DEFAULT_AD_CHANCE = 95
type Plug struct {
ID int
S3ID string
Owner string
ViewsRemaining int
Approved bool
PresignedURL string
}
type PlugList struct {
Data []string `form:"plugs[]"`
}
func (p Plug) IsDefault() bool {... | package main
import "math/rand"
import "time"
const DEFAULT_AD_CHANCE = 95
type Plug struct {
ID int
S3ID string
Owner string
ViewsRemaining int
Approved bool
PresignedURL string
}
type PlugList struct {
Data []string `form:"plugs[]"`
}
func (p Plug) IsDefault() bool {... | Fix Random Chance of Exception w/ customs | Fix Random Chance of Exception w/ customs
| Go | mit | liam-middlebrook/csh-plug |
345285a30844773b5141f898962dc7b10738a76b | graph.go | graph.go | // gogl provides a framework for representing and working with graphs.
package gogl
// Constants defining graph capabilities and behaviors.
const (
E_DIRECTED, EM_DIRECTED = 1 << iota, 1<<iota - 1
E_UNDIRECTED, EM_UNDIRECTED
E_WEIGHTED, EM_WEIGHTED
E_TYPED, EM_TYPED
E_SIGNED, EM_SIGNED
E_LOOPS, EM_LOOPS
E_MULTI... | // gogl provides a framework for representing and working with graphs.
package gogl
// Constants defining graph capabilities and behaviors.
const (
E_DIRECTED, EM_DIRECTED = 1 << iota, 1<<iota - 1
E_UNDIRECTED, EM_UNDIRECTED
E_WEIGHTED, EM_WEIGHTED
E_TYPED, EM_TYPED
E_SIGNED, EM_SIGNED
E_LOOPS, EM_LOOPS
E_MULTI... | Change a few straggling interface{} to Vertex. | Change a few straggling interface{} to Vertex.
| Go | mit | sdboyer/gogl,sdboyer/gogl |
fddd17b872d3987910a5695b478c5fdcf611c264 | post.go | post.go | package sechat
import (
"errors"
"fmt"
"net/http"
"net/url"
"strings"
)
// postForm is a utility method for sending a POST request with form data. The
// fkey is automatically added to the form data sent.
func (c *Conn) postForm(path string, data *url.Values) (*http.Response, error) {
data.Set("fkey", c.fkey)
... | package sechat
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)
var conflictRegexp = regexp.MustCompile(`\d+`)
// postForm is a utility method for sending a POST request with form data. The
// fkey is automatically added to the form data sent. If a 409 Conflict
... | Add proper response to throttling. | Add proper response to throttling.
| Go | mit | nathan-osman/go-sechat |
0292261bc4fb1511f197df986705327fd0b77f1d | util.go | util.go | package main
import (
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
)
var (
newlinePattern = regexp.MustCompile("\r\n|\r|\n")
)
func getLocalIP() string {
for _, i := range []string{"en0", "en1", "en2"} {
cmd := exec.Command("ipconfig", "getifaddr", i)
b, err := cmd.Output()
if err != nil {
continue
... | package main
import (
"io/ioutil"
"net"
"os"
"regexp"
"strings"
)
var (
newlinePattern = regexp.MustCompile("\r\n|\r|\n")
)
func getLocalIP() string {
addrs, err := net.InterfaceAddrs()
if err != nil {
return ""
}
for _, address := range addrs {
ipnet, ok := address.(*net.IPNet)
if !ok {
continue... | Fix the way to get local ip | Fix the way to get local ip
| Go | mit | creasty/rid,creasty/rid |
c76e444a00f4e2bf177c7b929ba9f2fc916a0d60 | src/lib/vm/y_test.go | src/lib/vm/y_test.go | package vm
import "testing"
func TestY(t *testing.T) {
for _, n := range []float64{0, 1, 2, 3, 4, 5, 6, 100} {
n1 := float64(Y(Normal(NewLazyFunction(lazyFactorial))).(Callable).Call(NumberThunk(n)).(Number))
n2 := strictFactorial(n)
t.Logf("%d: %f == %f?\n", int(n), n1, n2)
if n1 != n2 {
t.Fail()
}
... | package vm
import "testing"
func TestY(t *testing.T) {
for _, n := range []float64{0, 1, 2, 3, 4, 5, 6, 100} {
n1 := lazyFactorial(NumberThunk(n))
n2 := strictFactorial(n)
t.Logf("%d: %f == %f?\n", int(n), n1, n2)
if n1 != n2 {
t.Fail()
}
}
for _, ts := range [][]*Thunk{
{NumberThunk(7)},
{Numb... | Test passing multiple arguments to Y f | Test passing multiple arguments to Y f
| Go | mit | raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp,raviqqe/tisp |
0b7cd4e7ebf04bd2946fbed5c754fbefc03fcda3 | util.go | util.go | package rollbar
import (
"fmt"
"os"
"runtime"
"strings"
)
func stderr(s string) {
os.Stderr.WriteString(fmt.Sprintf("Rollbar error: %s", s))
}
func stacktraceFrames(skip int) []map[string]interface{} {
frames := []map[string]interface{}{}
for i := skip; ; i++ {
pc, file, line, ok := runtime.Caller(i)
if ... | package rollbar
import (
"fmt"
"os"
"runtime"
"strings"
)
func stderr(s string) {
os.Stderr.WriteString(fmt.Sprintf("Rollbar error: %s\n", s))
}
func stacktraceFrames(skip int) []map[string]interface{} {
frames := []map[string]interface{}{}
for i := skip; ; i++ {
pc, file, line, ok := runtime.Caller(i)
i... | Add missing newline to error messages. | Add missing newline to error messages.
| Go | mit | stvp/rollbar,nazwa/rollbar |
471f5ffd6182e0a4ce2dbc4ee08ed89f88fd252e | pkg/sys/initd/manager.go | pkg/sys/initd/manager.go | package initd
type Manager interface {
ReloadDaemon() error
CreateComponent(name, contents string) (Component, error)
Start(Component) error
Stop(Component) error
Install(Component) error
Disable(Component) error
Extend(Component) error
Reload(Component) error
Validate(Component) error
}
| // initd provides interfaces and implementations for system initialization daemons
package initd
// Manager interface wraps initd gateway implementations
type Manager interface {
ReloadDaemon() error
CreateComponent(name, contents string) (Component, error)
Start(Component) error
Stop(Component) error
Install(C... | Include comments for initd types | Include comments for initd types
| Go | apache-2.0 | maxamillion/flamingo,maxamillion/flamingo,tmrts/flamingo,tmrts/flamingo |
33cc43ff8645eb214c756b09622c11ef38bc2473 | core/chaincode/accesscontrol/mapper_test.go | core/chaincode/accesscontrol/mapper_test.go | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package accesscontrol
import (
"testing"
"time"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/crypto/tlsgen"
"github.com/stretchr/testify/assert"
)
fu... | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package accesscontrol
import (
"testing"
"time"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric/bccsp/sw"
"github.com/hyperledger/fabric/common/crypto/tlsgen"
"github.com/stretchr/testify/assert"
)
func Te... | Remove GetDefault() in chaincode package | [FAB-15951] Remove GetDefault() in chaincode package
- Remove bccsp factory.GetDefault() function usage in chaincode
package. Replace with golang crypto sha256 and bootBCCSP in
unit tests.
Change-Id: I7af3550066010c8e96e08c9b76dfee086c39e44e
Signed-off-by: Chongxin Luo <7c0175c1e9b282afeb442298363614962e031204@ibm.co... | Go | apache-2.0 | muralisrini/fabric,stemlending/fabric,stemlending/fabric,manish-sethi/fabric-sidedb,manish-sethi/fabric-sidedb,hyperledger/fabric,stemlending/fabric,manish-sethi/fabric-sidedb,manish-sethi/fabric-sidedb,jimthematrix/fabric,manish-sethi/fabric-sidedb,jimthematrix/fabric,binhn/fabric,manish-sethi/fabric-sidedb,manish-set... |
d65ae684bf25d664a38b07acdf81ce796a57bf0f | irc/send_motd.go | irc/send_motd.go | package irc
import (
"bufio"
"fmt"
"os"
"sync"
)
const (
motdHeader = "- %s Message of the day - "
motdFooter = "- End of /MOTD command"
)
var (
motdOnce sync.Once
motd []string
)
// sendMOTD will send the message of the day to a relay.
func sendMOTD(state state, sink sink) {
motdOnce.Do(func() { loadM... | package irc
import (
"bufio"
"fmt"
"os"
"sync"
)
const (
motdHeader = "- %s Message of the day - "
motdFooter = "- End of /MOTD command"
)
var (
motdOnce sync.Once
motd []string
)
// sendMOTD will send the message of the day to a relay.
func sendMOTD(state state, sink sink) {
motdOnce.Do(func() { loadM... | Fix crash if no MOTD exists. | Fix crash if no MOTD exists.
| Go | mit | fimad/ggircd |
fe8ec541980121ba74b630825728b8d62dfa46d4 | cookie_set_handler.go | cookie_set_handler.go | package auth
import (
"net/http"
)
const CookieName = "ATC-Authorization"
type CookieSetHandler struct {
Handler http.Handler
}
func (handler CookieSetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
cookie, err := r.Cookie(CookieName)
if err == nil && r.Header.Get("Authorization") == "" {
r.Heade... | package auth
import (
"net/http"
)
const CookieName = "ATC-Authorization"
type CookieSetHandler struct {
Handler http.Handler
}
func (handler CookieSetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
cookie, err := r.Cookie(CookieName)
if err == nil && r.Header.Get("Authorization") == "" {
r.Heade... | Add X- headers for security | Add X- headers for security
X-XSS, X-Content-Type-Options, X-Download-Options have sane defaults,
but X-Frame-Options would break existing functionality of including
concourse on iframes if we added this header by default.
Instead, we expose what to put in this header in the ATC flags,
defaulting it to no header.
[#... | Go | apache-2.0 | concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse |
8cc1969225b60f37956f011df7275d03a87edf3d | examples/nsscache-vault/main_test.go | examples/nsscache-vault/main_test.go | package main
import (
"net"
"os"
"path/filepath"
"testing"
"github.com/hashicorp/vault/http"
"github.com/hashicorp/vault/vault"
"github.com/stretchr/testify/assert"
)
func setupVault(t *testing.T) (net.Listener, error) {
core, _, token := vault.TestCoreUnsealed(t)
ln, addr := http.TestServer(t, core)
os.S... | package main
import (
"net"
"os"
"path/filepath"
"testing"
"github.com/hashicorp/vault/http"
"github.com/hashicorp/vault/vault"
"github.com/stretchr/testify/assert"
)
func setupVault(t *testing.T) (net.Listener, error) {
core, _, token := vault.TestCoreUnsealed(t)
ln, addr := http.TestServer(t, core)
os.S... | Check errors before deferring in tests | examples/nsscache-vault: Check errors before deferring in tests
| Go | mit | MiLk/nsscache-go |
61be1322444f6fa13d47dc56cca63c8b49208fdf | sqlite3_windows.go | sqlite3_windows.go | // Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// +build windows
package sqlite3
/*
#cgo CFLAGS: -I. -fno-stack-check -fno-stack-protector -mno-stack-arg-probe
#cgo windows,386 CFLAGS: -D_localt... | // Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// +build windows
package sqlite3
/*
#cgo CFLAGS: -I. -fno-stack-check -fno-stack-protector -mno-stack-arg-probe
#cgo windows,386 CFLAGS: -D_USE_32... | Fix compile for old mingw32 | Fix compile for old mingw32
| Go | apache-2.0 | helight/helight_code,xeodou/go-sqlcipher,danderson/go-sqlite3,helight/helight_code,shaxbee/go-sqlite3,lyonel/go-sqlite3,helight/helight_code,mattn/go-sqlite3,lyonel/go-sqlite3,lyonel/go-sqlite3,mattn/go-sqlite3,helight/helight_code,helight/helight_code,xeodou/go-sqlcipher,mattn/go-sqlite3,accense/go-sqlite3,shaxbee/go-... |
d13b3a39c252db8ec0639499fe39c2d88f0e8693 | lib/backend/hdfsbackend/config.go | lib/backend/hdfsbackend/config.go | package hdfsbackend
import "code.uber.internal/infra/kraken/lib/backend/hdfsbackend/webhdfs"
// Config defines configuration for all HDFS clients.
type Config struct {
NameNodes []string `yaml:"namenodes"`
UserName string `yaml:"username"`
RootDirectory string `yaml:"root_directory"`
// ListConcurre... | package hdfsbackend
import "code.uber.internal/infra/kraken/lib/backend/hdfsbackend/webhdfs"
// Config defines configuration for all HDFS clients.
type Config struct {
NameNodes []string `yaml:"namenodes"`
UserName string `yaml:"username"`
RootDirectory string `yaml:"root_directory"`
// ListConcurre... | Increase list concurrency to 16 | Increase list concurrency to 16
Summary: Too slow in IRN, causes nginx to timeout.
Reviewers: O1553 Project kraken: Add blocking reviewers, evelynl
Reviewed By: O1553 Project kraken: Add blocking reviewers, evelynl
Subscribers: jenkins
Differential Revision: https://code.uberinternal.com/D2311711
| Go | apache-2.0 | uber/kraken,uber/kraken,uber/kraken,uber/kraken,uber/kraken |
9dfd3487f796dbbd24fdc325c27975a19c9d6b84 | front.go | front.go | package main
import (
"log"
"net/http"
"os"
)
type Config struct {
port string
allowedContentTypes string // uncompiled regex
}
func envOrDefault(key string, default_value string) string {
env := os.Getenv(key)
if env != "" {
return env
} else {
return default_value
}
}
func main() {
co... | package main
import (
"log"
"net/http"
"os"
)
type Config struct {
port string
allowedContentTypes string // uncompiled regex
}
func envOrDefault(key string, default_value string) string {
env := os.Getenv(key)
if env != "" {
return env
} else {
return default_value
}
}
func main() {
co... | Return ok for favicon requests | Return ok for favicon requests
| Go | mit | ryanlower/front,experiment/front |
a90419e98835ea696c1f20d91b2b8e0cfbd335c3 | client.go | client.go | package twigo
func NewClient(account_sid, auth_token, number string) (*Client, error) {
c := &Client{AccountSid:account_sid,AuthToken:auth_token,Number:number}
return c, nil
}
func (c *Client) Text(msg_sms *SMS) (*TwilioResponse, *TwilioError) {
resp, twil_err := Send(c, msg_sms)
return resp, twil_err
}
func (... | package twigo
func NewClient(account_sid, auth_token, number string) (*Client, error) {
c := &Client{AccountSid:account_sid,AuthToken:auth_token,Number:number}
err := Validate(*c)
if err != nil {
return nil,err
}
return c, nil
}
func (c *Client) Text(msg_sms *SMS) (*TwilioResponse, *TwilioError, error) {
... | Handle field validation for SMS, Client, and Voice types | Handle field validation for SMS, Client, and Voice types
| Go | mit | fibonacci1729/twigo |
0924b8f14e9f224c5613f9ae37bc95abbf4fb9d1 | alpm/format.go | alpm/format.go | // Copyright (c) 2015, Ben Morgan. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Package alpm works with parts of Arch Linux packages.
package alpm
import "strings"
// PackageGlob is a glob that should only find packages.
const Package... | // Copyright (c) 2015, Ben Morgan. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Package alpm works with parts of Arch Linux packages.
package alpm
import "strings"
// PackageGlob is a glob that should only find packages.
const Package... | Add support for reading *.tar.zst package files | Add support for reading *.tar.zst package files
| Go | mit | goulash/pacman,cassava/repoctl |
68f22a40f30279005d260ba38590e32a0eff01be | pkg/kubelet/root_context_linux.go | pkg/kubelet/root_context_linux.go | // +build linux
/*
Copyright 2015 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 applicable law... | // +build linux
/*
Copyright 2015 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 applicable law... | Remove workaround for libcontainer Getfilecon bug | Remove workaround for libcontainer Getfilecon bug
https://github.com/docker/libcontainer/issues/499 has been fixed
| Go | apache-2.0 | bnprss/kubernetes,zgutterm/kubernetes,ihmccreery/kubernetes,eparis/kubernetes,jfrazelle/kubernetes,ymqytw/kubernetes,rubenv/kubernetes,sbusso/kubernetes,chbatey/kubernetes,Rotwang/kubernetes,micmro/kubernetes,calebamiles/kubernetes,philips/kubernetes,rubenv/kubernetes,nicksardo/kubernetes,amos6224/kubernetes,abdokh/kub... |
847fdb40c0d93fc3fec0f13a4ac45041018a6382 | go/src/koding/db/models/group.go | go/src/koding/db/models/group.go | package models
import (
"labix.org/v2/mgo/bson"
)
type Group struct {
Id bson.ObjectId `bson:"_id" json:"-"`
Body string `bson:"body" json:"body"`
Title string `bson:"title" json:"title"`
Slug string ... | package models
import (
"labix.org/v2/mgo/bson"
)
type Group struct {
Id bson.ObjectId `bson:"_id" json:"-"`
Body string `bson:"body" json:"body"`
Title string `bson:"title" json:"title"`
Slug string ... | Add StackTemplate field to Group mongo model | Mongo: Add StackTemplate field to Group mongo model
| Go | agpl-3.0 | drewsetski/koding,drewsetski/koding,usirin/koding,usirin/koding,rjeczalik/koding,jack89129/koding,kwagdy/koding-1,cihangir/koding,drewsetski/koding,alex-ionochkin/koding,andrewjcasal/koding,acbodine/koding,rjeczalik/koding,jack89129/koding,koding/koding,koding/koding,usirin/koding,kwagdy/koding-1,kwagdy/koding-1,mertay... |
2e9bf59a29f2390bb668838d8c812a836d18ab92 | generators/hooks/build/dev.go | generators/hooks/build/dev.go | package build
import (
"encoding/json"
"github.com/nanobox-io/nanobox/models"
)
func DevPayload(appModel *models.App) string {
rtn := map[string]interface{}{}
rtn["env"] = appModel.Evars
rtn["boxfile"] = appModel.DeployedBoxfile
bytes, _ := json.Marshal(rtn)
return string(bytes)
}
| package build
import (
"encoding/json"
"github.com/nanobox-io/nanobox/models"
)
func DevPayload(appModel *models.App) string {
// create an APP_IP evar
evars := appModel.Evars
evars["APP_IP"] = appModel.LocalIPs["env"]
rtn := map[string]interface{}{}
rtn["env"] = evars
rtn["boxfile"] = appModel.DeployedBoxf... | Add an app ip into the run container | Add an app ip into the run container
| Go | unknown | nanobox-io/nanobox,nanobox-io/nanobox,nanobox-io/nanobox-cli,nanobox-io/nanobox-cli,nanobox-io/nanobox-cli,pagodabox/nanobox-cli,pagodabox/nanobox-cli |
e8db3371d30853fbcbcc28df1df30b1bba772a13 | compare_and_swap.go | compare_and_swap.go | package main
import (
"flag"
"fmt"
)
const CompareAndSwapUsage = `usage: etcdctl [etcd flags] compareAndSwap <key> <value> [testAndSet flags]
either prevValue or prevIndex needs to be given
special flags: --ttl to set a key with ttl
--prevValue to set the previous value
--prevIndex to set the previous i... | package main
import (
"flag"
"fmt"
)
const CompareAndSwapUsage = `usage: etcdctl [etcd flags] compareAndSwap <key> <value> [testAndSet flags]
either prevvalue or previndex needs to be given
special flags: --ttl to set a key with ttl
--prevvalue to set the previous value
--previndex to set the previous i... | Change flag names to lower case | Change flag names to lower case
| Go | apache-2.0 | jakubigla/etcdctl,jakubigla/etcdctl |
7a6c99115283eef33d0ba62515676c0d8cf40335 | server/mcstored/service/rest/upload/uploader.go | server/mcstored/service/rest/upload/uploader.go | package upload
import "github.com/materials-commons/mcstore/pkg/app/flow"
type uploader struct {
tracker *uploadTracker
}
func newUploader() *uploader {
return &uploader{
tracker: newUploadTracker(),
}
}
func (u *uploader) processRequest(request *flow.Request) error {
if err := request.Write(); err != nil {
... | package upload
import "github.com/materials-commons/mcstore/pkg/app/flow"
type uploader struct {
tracker *uploadTracker
w RequestWriter
}
func newUploader() *uploader {
return &uploader{
tracker: newUploadTracker(),
}
}
func (u *uploader) processRequest(request *flow.Request) error {
if err := u.w.Writ... | Change to using a request writer interface. | Change to using a request writer interface.
| Go | mit | materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore |
3121a8c85e4ac887a36aa98ec8138ac920013679 | mackerel-plugin-rabbitmq/rabbitmq_test.go | mackerel-plugin-rabbitmq/rabbitmq_test.go | README.mdpackage main
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/michaelklishin/rabbit-hole"
"reflect"
)
func TestGraphDefinition(t *testing.T){
var rabbitmq RabbitMQPlugin
graphdef := rabbitmq.GraphDefinition()
if len(graphdef) != 2 {
t.Error("GetTempfilename: %d should be 2", len(... | package main
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/michaelklishin/rabbit-hole"
"reflect"
)
func TestGraphDefinition(t *testing.T){
var rabbitmq RabbitMQPlugin
graphdef := rabbitmq.GraphDefinition()
if len(graphdef) != 2 {
t.Error("GetTempfilename: %d should be 2", len(graphdef)... | Fix test file first line | Fix test file first line
| Go | apache-2.0 | ariarijp/mackerel-agent-plugins,ki38sato/mackerel-agent-plugins,hiroakis/mackerel-agent-plugins,hiroakis/mackerel-agent-plugins,xorphitus/mackerel-agent-plugins,y-kuno/mackerel-agent-plugins,xorphitus/mackerel-agent-plugins,y-kuno/mackerel-agent-plugins,ki38sato/mackerel-agent-plugins,xorphitus/mackerel-agent-plugins,h... |
9f90cacd5f6aabe4dd2ec87773cdaac1cd6593d0 | clusterclient/client.go | clusterclient/client.go | package client
import (
"encoding/json"
"io/ioutil"
"net/http"
)
type Map struct {
Node struct {
ServerList string `json:"serverList"`
LuxMap string `json:"luxMap"`
} `json:"nodes"`
}
func Connect(clusterURL string) (string, error) {
resp, err := http.Get(clusterURL)
if err != nil {
return "", err
... | package client
import (
"encoding/json"
"io/ioutil"
"net/http"
)
type Map struct {
Node struct {
ServerList string `json:"serverList"`
LuxMap string `json:"luxMap"`
} `json:"nodes"`
}
var nodeMap *Map
func RunClient(cluster string) {
// update nodeMap every second
}
func GetMap() *Map {
return node... | Add interface defn to clusterClient | Add interface defn to clusterClient
| Go | apache-2.0 | maniktaneja/luxstor |
aefe157d01c5bf818ac41d004dffa7e8c0763e36 | framework/bindata_dev.go | framework/bindata_dev.go | // +build !rel
package main
import (
"fmt"
"io/ioutil"
)
// Asset reads the file at the abs path given
func Asset(name string) ([]byte, error) {
dat, err := ioutil.ReadFile(name)
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return dat, nil
}
| // +build !rel
package main
import (
"fmt"
"io/ioutil"
)
// Asset reads the file at the abs path given
func Asset(name string) ([]byte, error) {
dat, err := ioutil.ReadFile(name)
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return dat, nil
}
| Add development bindata to override prod bindata | Add development bindata to override prod bindata
| Go | apache-2.0 | sargun/riak-mesos,calebTomlinson/riak-mesos,calebTomlinson/riak-mesos,sargun/riak-mesos,calebTomlinson/riak-mesos,calebTomlinson/riak-mesos,sargun/riak-mesos,sargun/riak-mesos,sargun/riak-mesos |
bcc23ea44b860a4ab0b284bfd1c88f6b5206dab4 | btsoot.go | btsoot.go | package main
import "fmt"
func main() {
fmt.Println("BTSOOT - Copyright (C) 2016-2017 Paul Kramme")
} | package main
import "fmt"
import "flag"
import "encoding/json"
import "io/ioutil"
type location struct {
Source string
Dest string
Name string
More_special_settings bool
}
type config struct {
Some_generell_settings bool
Locations []location
}
func main() {
fmt.Println("BTSOOT - Copyright (C) 2016-2017 Paul ... | Add config writer, add and rm | Add config writer, add and rm
| Go | bsd-3-clause | paulkramme/btsoot |
2297fe68f43e217e7ef6d2edde9be76bfc0bf0c3 | connection.go | connection.go | package nntp
import (
"fmt"
"io"
)
type Conn struct {
}
func (c *Conn) Write(p []byte) (int, error) {
return 0, nil
}
func (c *Conn) Read(p []byte) (n int, err error) {
return
}
func (c *Conn) do(format string, is ...interface{}) io.ReadCloser {
cmd := fmt.Sprintf(format, is...)
fmt.Fprintf(c, "%s\r\n", cmd)... | package nntp
import "fmt"
type Conn struct {
}
func (c *Conn) Write(p []byte) (int, error) {
return 0, nil
}
func (c *Conn) Read(p []byte) (n int, err error) {
return
}
func (c *Conn) Do(format string, is ...interface{}) *Reader {
cmd := fmt.Sprintf(format, is...)
fmt.Fprintf(c, "%s\r\n", cmd)
return nil
}
| Return a reader instead of interface | Return a reader instead of interface
| Go | mit | andrewstuart/nntp |
08a8175d5b69b89a62616145575b48de0c4f5b18 | models/record_match_context.go | models/record_match_context.go | /*
Copyright 2016 The MITRE Corporation. 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 applicable law or agre... | /*
Copyright 2016 The MITRE Corporation. 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 applicable law or agre... | Add Type field to RecordMatchContext | Add Type field to RecordMatchContext
| Go | apache-2.0 | mitre/ptmatch,mitre/ptmatch,mitre/ptmatch |
c434bbe48ee9c5067abedc31239db2f853ac501f | docode.go | docode.go | package main
import (
"github.com/tscolari/docode/packages/docode"
"github.com/tscolari/docode/packages/docodeconfig"
"flag"
)
func main() {
docodeFilePath := flag.String("config", "./DocodeFile", "ConfigFile to load")
flag.Parse()
fileConfig := docodeconfig.NewFromFile(*docodeFilePath)
runner := docode.New(... | package main
import (
"github.com/tscolari/docode/packages/docode"
"github.com/tscolari/docode/packages/docodeconfig"
"flag"
)
func main() {
docodeFilePath := flag.String("c", "./DocodeFile", "ConfigFile to load")
argsConfig := fetchConfigFromArgs()
flag.Parse()
fileConfig := docodeconfig.NewFromFile(*docod... | Add `-k` argument to set SSH-KEY on cli | Add `-k` argument to set SSH-KEY on cli
Also renames the `-config` argument to `-c`
| Go | mit | tscolari/docode |
3f90026f236689c714f7f601f8d50fd186695829 | migrations/migrations.go | migrations/migrations.go | package migrations
import (
"github.com/GeertJohan/go.rice"
"github.com/mattes/migrate"
"github.com/pkg/errors"
// Enable PostgreSQL driver for migration tool
_ "github.com/mattes/migrate/database/postgres"
// Enable File source for migration tool
_ "github.com/mattes/migrate/source/file"
// Enable go.rice sou... | package migrations
import (
"github.com/diyan/assimilator/migrations/source"
"github.com/GeertJohan/go.rice"
"github.com/mattes/migrate"
"github.com/pkg/errors"
// Enable PostgreSQL driver for migration tool
_ "github.com/mattes/migrate/database/postgres"
)
func UpgradeDB(databaseURL string) error {
// TODO W... | Remove obsolete code from migration package | Remove obsolete code from migration package
| Go | mit | diyan/assimilator,diyan/assimilator,diyan/assimilator |
8fe85e1d20b1777319721d009d0b5806c068c34d | docker/letsencrypt.go | docker/letsencrypt.go | package main
import (
"fmt"
"net/http"
"strings"
)
func handler(w http.ResponseWriter, r *http.Request) {
proc := sh("/usr/local/letsencrypt/letsencrypt.sh %s 2>&1", strings.Split(r.Header["Host"][0], ":")[0])
fmt.Fprintln(w,proc.stdout)
}
func main() {
http.HandleFunc("/.well-known/letsencrypt", handler... | package main
import (
"fmt"
"net/http"
"strings"
)
func handler(w http.ResponseWriter, r *http.Request) {
proc := sh("/usr/local/letsencrypt/letsencrypt.sh %s 2>&1", strings.Split(r.Header["X-Forwarded-Host"][0], ":")[0])
fmt.Fprintln(w,proc.stdout)
}
func main() {
http.HandleFunc("/.well-known/letsencry... | Revert "Simplify config for LetsEncrypt." | Revert "Simplify config for LetsEncrypt."
This reverts commit 2409dec9c7fd161e20522877a6088c95801072cd.
| Go | mit | appuio/acme-tiny,appuio/acme-tiny,appuio/acme-tiny |
ccd06e5b66621568f7b66d9867779eaef843a75f | fuse/ipns/common.go | fuse/ipns/common.go | package ipns
import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/ipfs/go-ipfs/core"
mdag "github.com/ipfs/go-ipfs/merkledag"
nsys "github.com/ipfs/go-ipfs/namesys"
ci "github.com/ipfs/go-ipfs/p2p/crypto"
path "github.com/ipfs/go-ipfs/path"
ft "github.com/ipfs/g... | package ipns
import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/ipfs/go-ipfs/core"
mdag "github.com/ipfs/go-ipfs/merkledag"
nsys "github.com/ipfs/go-ipfs/namesys"
ci "github.com/ipfs/go-ipfs/p2p/crypto"
path "github.com/ipfs/go-ipfs/path"
ft "github.com/ipfs/g... | Fix ctx used in pub.Publish | Fix ctx used in pub.Publish
License: MIT
Signed-off-by: rht <ad8caa660fcfaac620006d957beb321cc612ecfe@gmail.com>
| Go | mit | jefhe2005/ipfs,keltia/go-ipfs,ianopolous/go-ipfs,kevina/go-ipfs,insionng/go-ipfs,ipfs-filestore/go-ipfs,kyledrake/go-ipfs,WeMeetAgain/go-ipfs,tswindell/go-ipfs,juztamau5/go-ipfs,bconfais/go-ipfs,ion1/go-ipfs,aviau/go-ipfs,adrusi/go-ipfs,shaunstanislaus/go-ipfs,tswindell/go-ipfs,JustinDrake/go-ipfs,insionng/go-ipfs,palk... |
69b1e2ca8664dbf87cf59994fb6a1b28d80c5f26 | sqlego_test.go | sqlego_test.go | package sqlego
import "testing"
func TestSelectStatement(t *testing.T) {
node := Select("Users", []string{"id", "name", "email"})
sql := node.Compile()
if sql != "SELECT id,name,email FROM Users;" {
t.Fatal(sql)
}
}
| package sqlego
import (
s "strings"
"testing"
)
func TestSelectStatement(t *testing.T) {
node := Select("Users", []string{"id", "name", "email"})
sql := node.Compile()
if sql != "SELECT id,name,email FROM Users;" {
t.Fatal(sql)
}
}
func TestUpdateStatement(t *testing.T) {
node := Update("Users", map[string]... | Add basic UPDATE statement testing | Add basic UPDATE statement testing
Since the order of map entries could change randomly, we have to test each argument separately.
| Go | mit | brucehsu/sqlego |
a52a9ad69a86c54910870071a4fe788ec9117b51 | 01-Go/01_hello_world/main.go | 01-Go/01_hello_world/main.go | package main
import "fmt"
func main() {
fmt.Printf("Hello World\n")
}
| package main
import "fmt"
func main() {
str := "Hello World"
fmt.Println(str)
}
| Update hello world to include a variable | Update hello world to include a variable
| Go | mit | sampov2/one-language-per-month-2015,sampov2/one-language-per-month-2015,sampov2/one-language-per-month-2015 |
08e8f3bd51f8e816de5902069f80704ece1957f4 | src/pkg/os/signal/signal_test.go | src/pkg/os/signal/signal_test.go | // 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 signal
import (
"syscall"
"testing"
)
func TestSignal(t *testing.T) {
// Send this process a SIGHUP.
syscall.Syscall(syscall.SYS_KILL, uintptr(sys... | // 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 signal
import (
"syscall"
"testing"
)
func TestSignal(t *testing.T) {
// Send this process a SIGHUP.
syscall.Syscall(syscall.SYS_KILL, uintptr(sys... | Use t.Errorf for formatted error output. | Use t.Errorf for formatted error output.
R=dsymonds1
CC=golang-dev
http://codereview.appspot.com/183049 | Go | bsd-3-clause | abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go |
3c5a6284e040a6ee3685c16927ca6d1bb163b3e0 | middlewares/key_auth.go | middlewares/key_auth.go | package middlewares
import (
"github.com/xaviergodart/gydro/errors"
"github.com/xaviergodart/gydro/models"
"strconv"
"net/http"
)
var (
KeyParam string = "apikey"
)
func KeyAuth(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
keyget := r.URL.Query().Ge... | package middlewares
import (
"github.com/xaviergodart/gydro/errors"
"github.com/xaviergodart/gydro/models"
"strconv"
"net/http"
)
var (
KeyParam string = "apikey"
)
func KeyAuth(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
keyget := r.URL.Query().Ge... | Fix wrong header for KeyAuth middleware | Fix wrong header for KeyAuth middleware
| Go | mit | xaviergodart/gydro |
f3b52d5e190706d56ac160dce08565363df796ba | ld/api.go | ld/api.go | // Copyright 2015 Stanislav Nazarenko
//
// 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... | // Copyright 2015 Stanislav Nazarenko
//
// 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... | Fix docstrings for JsonLdApi to avoid confusion | Fix docstrings for JsonLdApi to avoid confusion
See #4 for more details
| Go | apache-2.0 | kazarena/json-gold |
85ebca1bc6e741f02d493cbd7b1ef506e59aa2f7 | goroutines.go | goroutines.go | package main
import (
"fmt"
"time"
"sync"
)
var wg sync.WaitGroup
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
if j == -1 {
wg.Done()
return
}
fmt.Println("worker", id, "processing job", j)
time.Sleep(time.Second)
results <- j * 2
}
}
func printer(results <-c... | package main
import (
"fmt"
"time"
"sync"
)
var wg sync.WaitGroup
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
if j == -1 {
wg.Done()
break
}
fmt.Println("worker", id, "processing job", j)
time.Sleep(time.Second)
results <- j * 2
}
}
func printer(results <-ch... | Remove fatal error in workers | Remove fatal error in workers
| Go | mit | icambridge/go-playground |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.