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 |
|---|---|---|---|---|---|---|---|---|---|
e2e1ab814c27496d1847ab8c0dad3a06f149ffbc | example/simple_test.go | example/simple_test.go | package vcr_test
import (
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/dnaeon/go-vcr/recorder"
)
func TestSimple(t *testing.T) {
// Start our recorder
r, err := recorder.New("fixtures/golang-org")
if err != nil {
t.Fatal(err)
}
defer r.Stop()
// Create an HTTP client and inject our transport
... | package vcr_test
import (
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/dnaeon/go-vcr/recorder"
)
func TestSimple(t *testing.T) {
// Start our recorder
r, err := recorder.New("fixtures/golang-org")
if err != nil {
t.Fatal(err)
}
defer r.Stop() // Make sure recorder is stopped once done with it
... | Add commment to stop recorder once done with it | Add commment to stop recorder once done with it
| Go | bsd-2-clause | davars/go-vcr |
d31e4cb261b8b38a51c8f536829e843002868a70 | pkg/dns/doc.go | pkg/dns/doc.go | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Use Go canonical import paths | Use Go canonical import paths
Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports
Fixes #29014
| Go | apache-2.0 | cmluciano/dns,kubernetes/dns,corlettb/dns,bowei/dns,kubernetes/dns,bowei/dns,corlettb/dns,cmluciano/dns,kubernetes/dns |
c0350dcecd6bb9c85f3b87b2e92a2fc3ab81eea0 | file.go | file.go | package shade
import (
"fmt"
"time"
)
type File struct {
Filename string
Filesize int64
ModifiedTime time.Time
Chunksize int
Chunks []Chunk
AesKey []byte
}
type Chunk struct {
Index int
Sha256 []byte
}
func (f *File) String() string {
out := fmt.Sprintf("{Filename: %s, Filesize: %... | package shade
import (
"fmt"
"time"
)
type File struct {
Filename string
Filesize int64
ModifiedTime time.Time
Chunksize int
Chunks []Chunk
AesKey []byte
}
type Chunk struct {
Index int
Sha256 []byte
}
func (f *File) String() string {
out := fmt.Sprintf("{Filename: %q, Filesize: %... | Fix bug in AesKey printing, quote strings. | Fix bug in AesKey printing, quote strings.
| Go | apache-2.0 | asjoyner/shade,asjoyner/shade |
1761a581e0bc09861d13260de44102f90046c324 | fileEntry.go | fileEntry.go | package main
import (
"io"
"os"
"github.com/anacrolix/torrent"
)
// SeekableContent describes an io.ReadSeeker that can be closed as well.
type SeekableContent interface {
io.ReadSeeker
io.Closer
}
// FileEntry helps reading a torrent file.
type FileEntry struct {
*torrent.File
Reader *torrent.Reader
}
// S... | package main
import (
"io"
"os"
"github.com/anacrolix/torrent"
)
// SeekableContent describes an io.ReadSeeker that can be closed as well.
type SeekableContent interface {
io.ReadSeeker
io.Closer
}
// FileEntry helps reading a torrent file.
type FileEntry struct {
*torrent.File
torrent.Reader
}
// NewFileRe... | Update FileEntry including torrent.Reader interface properly | Update FileEntry including torrent.Reader interface properly
| Go | mit | Sioro-Neoku/go-peerflix |
3b1f5833628c5a10a133a62c62d3b7263b0b49f9 | _examples/helloworld/main.go | _examples/helloworld/main.go | package main
import (
"os"
log15 "gopkg.in/inconshreveable/log15.v2"
"github.com/CyCoreSystems/ari/client/native"
)
func main() {
if i := run(); i != 0 {
os.Exit(i)
}
}
func run() int {
// setup logging
native.Logger = log15.New()
log := log15.New()
opts := native.Options{
Application: "example",
... | package main
import (
"context"
"os"
log15 "gopkg.in/inconshreveable/log15.v2"
"github.com/CyCoreSystems/ari"
"github.com/CyCoreSystems/ari/client/native"
)
func main() {
if i := run(); i != 0 {
os.Exit(i)
}
}
func run() int {
// setup logging
native.Logger = log15.New()
log := log15.New()
opts := n... | Update example base on the new implementation of ari.Client | Update example base on the new implementation of ari.Client
| Go | apache-2.0 | baldrailers/ari,baldrailers/ari |
0e93f1795a8a479ce4ac381d103727b55f68b1e4 | server/http.go | server/http.go | package server
import (
"flag"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web/middleware"
"net/http"
)
var (
defaults *config
//decoder = schema.NewDecoder()
)
func start(conf *config) {
defaults = conf
flag.Set("bind", conf.Address) // Uh, I guess that's a bit strange
if conf.Proxy {
goji.Insert(m... | package server
import (
"flag"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
"github.com/zenazn/goji/web/middleware"
"net/http"
)
var (
defaults *config
//decoder = schema.NewDecoder()
)
func start(conf *config) {
defaults = conf
flag.Set("bind", conf.Address) // Uh, I guess that's a bit strange
i... | Add Server header to identify Lapitar | Add Server header to identify Lapitar
| Go | mit | LapisBlue/Lapitar,LapisBlue/Lapitar,LapisBlue/Lapitar |
dcf84f24998a756a1bd6a4b2930b8da76f314d77 | ecs/pkg/amazon/backend/down.go | ecs/pkg/amazon/backend/down.go | package backend
import (
"context"
"github.com/docker/ecs-plugin/pkg/amazon/types"
"github.com/docker/ecs-plugin/pkg/compose"
)
func (b *Backend) Down(ctx context.Context, options compose.ProjectOptions) error {
project, err := compose.ProjectFromOptions(&options)
if err != nil {
return err
}
err = b.api.D... | package backend
import (
"context"
"github.com/docker/ecs-plugin/pkg/amazon/types"
"github.com/docker/ecs-plugin/pkg/compose"
)
func (b *Backend) Down(ctx context.Context, options compose.ProjectOptions) error {
name := options.Name
if name == "" {
project, err := compose.ProjectFromOptions(&options)
if err... | Fix broken build on master | Fix broken build on master
Signed-off-by: Nicolas De Loof <27d8e526c390473e9c51da80626c6b0539b42f4f@gmail.com>
| Go | apache-2.0 | docker/compose,docker/compose,docker/compose |
d9a4c9242f7759e5b9dc7ac853c1a6799b584d44 | common.go | 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 |
32e5de053a6177f18824a3a99fcfa2e6b8094e12 | handlers/metrics.go | handlers/metrics.go | package handlers
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
RedirectHandlerRedirectCountMetric = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "router_redirect_handler_redirect_count",
Help: "Number of redirects handled by router redirect handlers",
},
[]string{
"redi... | package handlers
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
RedirectHandlerRedirectCountMetric = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "router_redirect_handler_redirect_count",
Help: "Number of redirects handled by router redirect handlers",
},
[]string{
"redi... | Add backend handler metric req count / resp secs | Add backend handler metric req count / resp secs
We want to measure:
* the number of requests
* the duration of responses
We measure the backend handlers individually, so the metrics are defined
as prometheus vectors
Signed-off-by: Toby Lorne <527052641d65eef236eeef9545b2acac74c35d57@digital.cabinet-office.gov.uk>
| Go | mit | alphagov/router |
23e9f8fae329f0527ed22317abb85a5859546417 | provider.go | provider.go | package axis
// Provider is the interface that wraps methods
// to manipulate position
type Provider interface {
Current() Position
Sleep(Distance)
After(Distance) <-chan Position
AfterFunc(Distance, func(Position)) Watcher
AfterChan(Distance, chan Position) Watcher
Since(Position) Distance
}
// UpdatableProvid... | package axis
// Positionable is the interface for positionable
// items on a axis
type Positionable interface {
Current() Position
Since(Position) Distance
}
// Sleepable is the interface for sleepable provider
type Sleepable interface {
Sleep(Distance)
}
// Trigger is the interface that wraps methods
// to defin... | Split the Provider interface into narrow ones | Split the Provider interface into narrow ones
| Go | mit | squioc/axis |
fbea3add036098159a4149f0c5dbafb74e4403ba | forwardOnlyStep.go | forwardOnlyStep.go | // +build mig_forward
package mig
const forward_only = true
type Step struct {
Name string
Migrate string
Prereq string
hash string
file string
pkg string
order string
}
func (step *Step) revert() string {
return ""
}
func (s *Step) setRevert(string) {
}
| // +build mig_forward
package mig
const forward_only = true
type Step struct {
Name string
Migrate string
Prereq string
hash string
file string
pkg string
order int
}
func (step *Step) revert() string {
return ""
}
func (s *Step) setRevert(string) {
}
| Fix an issue causing mig_forward tag to not compile | Fix an issue causing mig_forward tag to not compile
| Go | mit | jargv/mig |
33843bea85a4974a63f583b4d2dbf308e1c0c84b | non_debug.go | non_debug.go | // Copyright 2014 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build !debug
package main
import (
"io"
"io/ioutil"
"log"
"github.com/maruel/wi/editor"
)
func debugHook() io.Closer {
// It is i... | // Copyright 2014 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build !debug
package main
import (
"io"
"io/ioutil"
"log"
_ "github.com/maruel/circular"
"github.com/maruel/wi/editor"
)
func deb... | Add an artificial dependency on github.com/maruel/circular in release build. | Add an artificial dependency on github.com/maruel/circular in release build.
Otherwise go get -t ./... fails to retrieve circular, then ./presubmit.py fails
when trying to do a debug build.
| Go | apache-2.0 | wi-ed/wi |
79d4ef67b694ce875b11649cc504e32b22dab098 | export.go | export.go | package grid
import "fmt"
// ExportService handles communication with the Export related
// methods of the GRiD API.
//
// GRiD API docs: https://github.com/CRREL/GRiD-API/blob/v0.0/composed_api.rst#get-export-details
type ExportService struct {
client *Client
}
type File struct {
URL string `json:"url"`
Pk in... | package grid
import (
"fmt"
"io"
"log"
"mime"
"os"
)
// ExportService handles communication with the Export related
// methods of the GRiD API.
//
// GRiD API docs: https://github.com/CRREL/GRiD-API/blob/v0.0/composed_api.rst#get-export-details
type ExportService struct {
client *Client
}
type File struct {
U... | Add DownloadByPk back to the SDK | Add DownloadByPk back to the SDK
| Go | apache-2.0 | venicegeo/grid-sdk-go,venicegeo/grid-sdk-go |
7af6b67e2c52e289f1f660b0d0938d86c22ef3a3 | cmd/fix-imports/main.go | cmd/fix-imports/main.go | package main
import (
"fmt"
"os"
"github.com/Bowbaq/scala-imports"
"github.com/codegangsta/cli"
"github.com/spf13/viper"
)
var (
Version string
config scalaimports.Config
)
func init() {
viper.SetConfigName(".fix-imports")
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME")
if err := viper.ReadInConfi... | package main
import (
"fmt"
"os"
"github.com/Bowbaq/scala-imports"
"github.com/codegangsta/cli"
"github.com/spf13/viper"
)
var (
Version string
config scalaimports.Config
)
func init() {
viper.SetConfigName(".fix-imports")
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME")
if err := viper.ReadInConfi... | Update to new codegangsta/cli api | Update to new codegangsta/cli api
| Go | mit | Bowbaq/scala-imports |
d5fb5ff8584ef182ba3e58fe32148a6d0dc26440 | app/acceptance_test.go | app/acceptance_test.go | // +build acceptance
package app
import (
"os"
"time"
"github.com/DATA-DOG/godog"
)
func init() {
runs = append(runs, func() int {
format := "progress"
for _, arg := range os.Args[1:] {
// go test transforms -v option
if arg == "-test.v=true" {
format = "pretty"
break
}
}
return godog.... | // +build acceptance
package app
import (
"os"
"time"
"github.com/DATA-DOG/godog"
"github.com/goph/stdlib/net"
"google.golang.org/grpc"
)
func init() {
runs = append(runs, func() int {
format := "progress"
for _, arg := range os.Args[1:] {
// go test transforms -v option
if arg == "-test.v=true" {
... | Add gRPC specific code to acceptance test | Add gRPC specific code to acceptance test
| Go | mit | deshboard/boilerplate-model-service,deshboard/boilerplate-grpc-service |
15f52f3dcb328650c7357f654ae6d5391ca9362f | api.go | api.go | package b2
import ()
type B2 struct {
AccountID string
ApplicationKey string
AuthorizationToken string
ApiUrl string
DownloadUrl string
}
func MakeB2(accountId, appKey string) (*B2, error) {
return &B2{}, nil
}
| package b2
import (
"encoding/json"
"io/ioutil"
"net/http"
)
type B2 struct {
AccountID string
ApplicationKey string
AuthorizationToken string
ApiUrl string
DownloadUrl string
}
type authResponse struct {
AccountID string `json:"accountId"`
AuthorizationToken string... | Implement authorization (no error handling yet) | Implement authorization (no error handling yet)
| Go | isc | ifo/go.b2,ifo/b2 |
d0dbb5ec448c78d5902bca454dc5f62e9cdd6ccb | libbeat/common/string.go | libbeat/common/string.go | package common
type NetString []byte
// implement encoding.TextMarshaller interface to treat []byte as raw string
// by other encoders/serializers (e.g. JSON)
func (n NetString) MarshalText() ([]byte, error) {
return n, nil
}
| package common
// NetString store the byte length of the data that follows, making it easier
// to unambiguously pass text and byte data between programs that could be
// sensitive to values that could be interpreted as delimiters or terminators
// (such as a null character).
type NetString []byte
// MarshalText exis... | Document NetString & MarshalText interface | Document NetString & MarshalText interface
This adds GoLint documentation that explains what a netstring is and why the MarshalText function exists. | Go | mit | yapdns/yapdnsbeat,yapdns/yapdnsbeat |
727e6d8c543307c823af702d16b38fc91fc77cd1 | helper.go | helper.go | package mastodon
import (
"encoding/base64"
"net/http"
"os"
)
func Base64EncodeFileName(filename string) (string, error) {
file, err := os.Open(filename)
if err != nil {
return "", err
}
defer file.Close()
return Base64Encode(file)
}
func Base64Encode(file *os.File) (string, error) {
fi, err := file.Stat... | package mastodon
import (
"encoding/base64"
"net/http"
"os"
)
// Base64EncodeFileName returns the base64 data URI format string of the file with the file name.
func Base64EncodeFileName(filename string) (string, error) {
file, err := os.Open(filename)
if err != nil {
return "", err
}
defer file.Close()
ret... | Add godoc to Base64EncodeFileName and Base64Encode | Add godoc to Base64EncodeFileName and Base64Encode
| Go | mit | mattn/go-mastodon,178inaba/go-mastodon,mattn/go-mastodon |
17e917ddda383c08ba0a79e006a2659ac93508f9 | sacloud/prop_disk_connection.go | sacloud/prop_disk_connection.go | package sacloud
// propDiskConnection ディスク接続情報内包型
type propDiskConnection struct {
Connection EDiskConnection `json:",omitempty"` // ディスク接続方法
ConnectionOrder int `json:",omitempty"` // コネクション順序
}
// GetDiskConnection ディスク接続方法 取得
func (p *propDiskConnection) GetDiskConnection() EDiskConnection {
r... | package sacloud
// propDiskConnection ディスク接続情報内包型
type propDiskConnection struct {
Connection EDiskConnection `json:",omitempty"` // ディスク接続方法
ConnectionOrder int `json:",omitempty"` // コネクション順序
}
// GetDiskConnection ディスク接続方法 取得
func (p *propDiskConnection) GetDiskConnection() EDiskConnection {
r... | Add disk connection functions to disk | Add disk connection functions to disk
| Go | apache-2.0 | sacloud/libsacloud,yamamoto-febc/libsacloud |
5d7f4a76d077e30be17a32d75ad9a713ff019f85 | monitoring/vm.go | monitoring/vm.go | package main
import (
"go.skia.org/infra/go/gce"
"go.skia.org/infra/go/gce/server"
)
func MonitoringBase(name, ipAddress string) *gce.Instance {
vm := server.Server20170613(name)
vm.DataDisk.SizeGb = 1000
vm.DataDisk.Type = gce.DISK_TYPE_PERSISTENT_STANDARD
vm.ExternalIpAddress = ipAddress
vm.MachineType = gce... | package main
import (
"go.skia.org/infra/go/gce"
"go.skia.org/infra/go/gce/server"
)
func MonitoringBase(name, ipAddress string) *gce.Instance {
vm := server.Server20170613(name)
vm.DataDisk.SizeGb = 1000
vm.DataDisk.Type = gce.DISK_TYPE_PERSISTENT_STANDARD
vm.ExternalIpAddress = ipAddress
vm.MachineType = gce... | Use static IPs outside the 104.154.112.0/24 block in skia-monitoring | Use static IPs outside the 104.154.112.0/24 block in skia-monitoring
Bug: skia:6745
Change-Id: I96ea85d09055e5e32587b3bb0b525bb4f76fdc2d
Reviewed-on: https://skia-review.googlesource.com/38363
Reviewed-by: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.com>
Commit-Queue: Ravi Mistry <9fa2e7438b8cb730f96b7... | Go | bsd-3-clause | google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot |
bb2d16e9ce3a9ba52da19f6344fea83e1edd726a | cas/util.go | cas/util.go | package cas
import (
"log"
)
const (
_ = iota
DEBUG
INFO
WARN
)
// Utility functions for logging messages
func logMessage(actualLogLevel, msgLogLevel, msg string, ) {
if actualLogLevel <= msgLogLevel {
log.Printf("[%s] %s", msgLogLevel, msg)
}
}
// Utility function for logging message
func logMessagef(actu... | package cas
import (
"log"
"fmt"
)
const (
_ = iota
DEBUG
INFO
WARN
)
// Utility functions for logging messages
func logMessage(actualLogLevel, msgLogLevel, msg string, ) {
if actualLogLevel <= msgLogLevel {
log.Printf("[%s] %s", msgLogLevel, msg)
}
}
// Utility function for logging message
func logMessag... | Fix variadic function call for custom logger | Fix variadic function call for custom logger
| Go | isc | t3hmrman/casgo,t3hmrman/casgo,t3hmrman/casgo,t3hmrman/casgo |
7568e7172819ffc683c546d917654c16b89982d7 | xmpp_muc.go | xmpp_muc.go | // Copyright 2013 Flo Lauber <dev@qatfy.at>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// TODO(flo):
// - support password protected MUC rooms
// - cleanup signatures of join/leave functions
package xmpp
import (
"fmt"
)
const (... | // Copyright 2013 Flo Lauber <dev@qatfy.at>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// TODO(flo):
// - support password protected MUC rooms
// - cleanup signatures of join/leave functions
package xmpp
import (
"fmt"
)
const (... | Add ability to join password protected chat rooms | Add ability to join password protected chat rooms
| Go | bsd-3-clause | nb-titan/go-xmpp,pranavraja/go-xmpp,eagafonov/go-xmpp,titan-x/go-xmpp,dullgiulio/go-xmpp,ordbogen/go-xmpp,Like-all/go-xmpp,skiz/go-xmpp,mattn/go-xmpp |
a4308d1c7d3dac64808a326b397215cff0f527c2 | pkg/ref/parse.go | pkg/ref/parse.go | package ref
import (
"fmt"
"strings"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
)
var NodeNotFound = "can not build dialer to"
func IsNodeNotFound(err error) bool {
return strings.Contains(err.Error(), NodeNotFound)
}
func FromStrings(namespace, name string) string {
return fmt.Spri... | package ref
import (
"fmt"
"strings"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
)
var NodeNotFound = "can not build dialer to"
func IsNodeNotFound(err error) bool {
if err == nil {
return false
}
return strings.Contains(err.Error(), NodeNotFound)
}
func FromStrings(namespace, nam... | Check err not nil before calling clusterDialer | Check err not nil before calling clusterDialer
| Go | apache-2.0 | cjellick/rancher,cjellick/rancher,rancher/rancher,cjellick/rancher,rancherio/rancher,rancher/rancher,rancherio/rancher,rancher/rancher,rancher/rancher |
cf2d3848331b9f179835074d2a981617d9ae514a | players/users.go | players/users.go | package players
import "errors"
import "github.com/m4rw3r/uuid"
import "golang.org/x/crypto/bcrypt"
//import "fmt"
// The user associated with a player
type User struct {
Username string `json:"username"`
password string
Apikey string `json:"apikey"`
Admin bool `json:"admin"`
Locked bool ... | package players
import "errors"
import "github.com/m4rw3r/uuid"
import "golang.org/x/crypto/bcrypt"
//import "fmt"
// The user associated with a player
type User struct {
Username string `json:"username"`
password string
Apikey string `json:"apikey"`
Admin bool `json:"admin"`
Locked bool ... | Add comment about strange inverted err check. | Add comment about strange inverted err check.
| Go | apache-2.0 | ckpt/backend-services,ckpt/backend-services |
19c476e8ff76267225a6c1d847d8b78ab0477f76 | bootstrap/constants.go | bootstrap/constants.go | package bootstrap
type Size int
const (
ExtraSmall = iota - 2
Small
Medium
Large
)
type Alignment int
const (
Left Alignment = iota
Center
Right
)
| package bootstrap
type Size int
const (
ExtraSmall = iota - 2
Small
Medium
Large
)
func (s Size) String() string {
switch s {
case ExtraSmall:
return "xs"
case Small:
return "sm"
case Medium:
return "md"
case Large:
return "lg"
}
return ""
}
type Alignment int
const (
Left Alignment = iota
Cen... | Implement String() for bootstrap sizes | Implement String() for bootstrap sizes
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
77c33ffbadc89be6b36d3e021b9fe53ea77db754 | plugins/imgur.go | plugins/imgur.go | package plugins
import . "github.com/osmano807/joker/interfaces"
type Imgur struct {
name string
}
func (p *Imgur) Name() string {
return p.name
}
func (p *Imgur) Init() {
p.name = "Imgur"
}
func (p *Imgur) Handle(il *InputLine) (ol *OutputLine) {
ol = &OutputLine{}
ol.ChannelId = il.ChannelId
if il.URL.Ho... | package plugins
import . "github.com/osmano807/joker/interfaces"
type Imgur struct {
name string
}
func (p *Imgur) Name() string {
return p.name
}
func (p *Imgur) Init() {
p.name = "Imgur"
}
func (p *Imgur) Handle(il *InputLine) (ol *OutputLine) {
ol = &OutputLine{}
ol.ChannelId = il.ChannelId
if il.URL.Ho... | Remove querystring info from Imgur urls | Remove querystring info from Imgur urls
I probably will move to manually create the storeid URL, but for now it
will work.
| Go | bsd-2-clause | osmano807/joker |
e69c1515dd84649b0cfa338912e4cb05f0190152 | util.go | util.go | package main
import (
"os"
"os/user"
"path/filepath"
)
func GetUserCacheDirectory() string {
if baseDir := os.Getenv("XDG_CACHE_HOME"); baseDir != "" {
return filepath.Join(baseDir, "rfc")
}
if user, err := user.Current(); err == nil {
return filepath.Join(user.HomeDir, ".cache", "rfc")
}
if homeDir := ... | package main
import (
"os"
"os/user"
"path/filepath"
"runtime"
)
func GetHomeDirectory() string {
if runtime.GOOS == "windows" {
return os.Getenv("USERPROFILE")
}
return os.Getenv("HOME")
}
func GetUserCacheDirectory() string {
if baseDir := os.Getenv("XDG_CACHE_HOME"); baseDir != "" {
return filepath.Jo... | Use separate function for getting home directory | Use separate function for getting home directory
| Go | mit | kaorimatz/rfcs |
8a235f0a643c8ebe98a3a85b11aae73e8517ea07 | Etc/version.go | Etc/version.go | // +build windows
package etc
//go:generate cmd /c go run mkversioninfo.go version.txt version.txt < versioninfo.json > v.json && go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -icon=nyagos.ico -o ..\nyagos.syso v.json && del v.json
| // +build windows
package etc
// for default icon
//go:generate cmd /c go run mkversioninfo.go version.txt version.txt < versioninfo.json > v.json && go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -icon=nyagos.ico -o ..\nyagos.syso v.json && del v.json
// for second icon (disabled)
////go:generate ... | Add go-generate-code for second icon (but disabled) | Add go-generate-code for second icon (but disabled)
| Go | bsd-3-clause | zetamatta/nyagos,tsuyoshicho/nyagos |
2a056929682c75191190e7319af9ade106297476 | imageserver/rpcd/getImage.go | imageserver/rpcd/getImage.go | package rpcd
import (
"time"
"github.com/Symantec/Dominator/lib/srpc"
"github.com/Symantec/Dominator/proto/imageserver"
)
func (t *srpcType) GetImage(conn *srpc.Conn,
request imageserver.GetImageRequest,
reply *imageserver.GetImageResponse) error {
var response imageserver.GetImageResponse
response.Image = t.... | package rpcd
import (
"time"
"github.com/Symantec/Dominator/lib/image"
"github.com/Symantec/Dominator/lib/srpc"
"github.com/Symantec/Dominator/proto/imageserver"
)
func (t *srpcType) GetImage(conn *srpc.Conn,
request imageserver.GetImageRequest,
reply *imageserver.GetImageResponse) error {
var response images... | Add support for IgnoreFilesystem field to GetImage() SRPC handler. | Add support for IgnoreFilesystem field to GetImage() SRPC handler.
| Go | apache-2.0 | keep94/Dominator,Symantec/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator |
34d5b8867fe83403a6998d043a32a49e087f2477 | pkg/chrootarchive/chroot_unix.go | pkg/chrootarchive/chroot_unix.go | // +build !windows,!linux
package chrootarchive // import "github.com/docker/docker/pkg/chrootarchive"
import "golang.org/x/sys/unix"
func chroot(path string) error {
if err := unix.Chroot(path); err != nil {
return err
}
return unix.Chdir("/")
}
| // +build !windows,!linux
package chrootarchive // import "github.com/docker/docker/pkg/chrootarchive"
import "golang.org/x/sys/unix"
func chroot(path string) error {
if err := unix.Chroot(path); err != nil {
return err
}
return unix.Chdir("/")
}
func realChroot(path string) error {
return chroot(path)
}
| Add realChroot for non linux/windows | Add realChroot for non linux/windows
3029e765e241ea2b5249868705dbf9095bc4d529 broke compilation on
non-Linux/Windows systems.
This change fixes that.
Signed-off-by: Brian Goff <dc73d0991b982a8303e713ef531a313af77e242a@gmail.com>
| Go | apache-2.0 | nalind/docker,AkihiroSuda/docker,paralin/docker,justincormack/docker,nalind/docker,crosbymichael/docker,yosifkit/docker,SvenDowideit/docker,moby/moby,SvenDowideit/docker,djs55/docker,moby/moby,trebonian/docker,trebonian/docker,ibuildthecloud/docker,jimjag/docker,moul/docker,kolyshkin/moby,docker/docker,nawawi/docker,jv... |
041f2d1f132a3e63fac38d6f4830ddec4804edd9 | util_internal_test.go | util_internal_test.go | package instana
import "testing"
// Trace IDs (and Span IDs) are based on Java Signed Long datatype
const MinUint64 = uint64(0)
const MaxUint64 = uint64(18446744073709551615)
const MinInt64 = int64(-9223372036854775808)
const MaxInt64 = int64(9223372036854775807)
func TestIDGeneration(t *testing.T) {
}
| package instana
import (
"testing"
"github.com/stretchr/testify/assert"
)
// Trace IDs (and Span IDs) are based on Java Signed Long datatype
const MinUint64 = uint64(0)
const MaxUint64 = uint64(18446744073709551615)
const MinInt64 = int64(-9223372036854775808)
const MaxInt64 = int64(9223372036854775807)
func Test... | Test range of generated IDs. | Test range of generated IDs.
| Go | mit | instana/golang-sensor,instana/golang-sensor |
0a967f8446dd0e5cbc7a6f950a6327fba073b59b | aws/data_source_aws_iot_endpoint_test.go | aws/data_source_aws_iot_endpoint_test.go | package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSIotEndpointDataSource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: test... | package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSIotEndpointDataSource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: test... | Remove explicit id attribute check | tests/data-source/aws_iot_endpoint: Remove explicit id attribute check
| Go | mpl-2.0 | Ninir/terraform-provider-aws,kjmkznr/terraform-provider-aws,terraform-providers/terraform-provider-aws,terraform-providers/terraform-provider-aws,nbaztec/terraform-provider-aws,nbaztec/terraform-provider-aws,kjmkznr/terraform-provider-aws,Ninir/terraform-provider-aws,nbaztec/terraform-provider-aws,nbaztec/terraform-pro... |
94abb0a3b762b06afcb443fa602b2c70332bf5dd | pkg/containers/docker.go | pkg/containers/docker.go | package containers
import (
"github.com/fsouza/go-dockerclient"
)
type DockerRuntime struct {
Client *docker.Client
}
func (r DockerRuntime) isRelated(volume string, container *docker.Container) bool {
for _, mount := range container.Mounts {
if mount.Name == volume && mount.Driver == "dvol" {
return true
... | package containers
import (
"github.com/fsouza/go-dockerclient"
)
type DockerRuntime struct {
Client *docker.Client
}
func (r DockerRuntime) isRelated(volume string, container *docker.Container) bool {
for _, mount := range container.Mounts {
if mount.Name == volume && mount.Driver == "dvol" {
return true
... | Return error if we can't inspect a container | Return error if we can't inspect a container
| Go | apache-2.0 | ClusterHQ/dvol,ClusterHQ/dvol,ClusterHQ/dvol |
cd36179573e1a3f8f4f80f0f4fbef9299e41fc67 | example/http_breaker.go | example/http_breaker.go | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/sony/gobreaker"
)
var cb *gobreaker.CircuitBreaker
func init() {
var st gobreaker.Settings
st.Name = "HTTP GET"
st.ReadyToTrip = func(counts gobreaker.Counts) bool {
failureRatio := float64(counts.TotalFailures) / float64(counts.Requests... | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/sony/gobreaker"
)
var cb *gobreaker.CircuitBreaker
func init() {
var st gobreaker.Settings
st.Name = "HTTP GET"
st.ReadyToTrip = func(counts gobreaker.Counts) bool {
failureRatio := float64(counts.TotalFailures) / float64(counts.Requests... | Remove an unused format string | Remove an unused format string
| Go | mit | sony/gobreaker |
0973942020260734e49a59cacb35d78c64aea566 | read_test.go | read_test.go | package maxreader_test
import (
"io/ioutil"
"strings"
"testing"
"."
)
func Test(t *testing.T) {
type entry struct {
s string
ok bool
}
table := []entry{
{"", true},
{"h", true},
{"hell", true},
{"hello", true},
{"hellow", false},
{"helloworld", false},
}
for _, e := range table {
b, err... | package maxreader_test
import (
"io/ioutil"
"strings"
"testing"
"github.com/ninchat/maxreader"
)
func Test(t *testing.T) {
type entry struct {
s string
ok bool
}
table := []entry{
{"", true},
{"h", true},
{"hell", true},
{"hello", true},
{"hellow", false},
{"helloworld", false},
}
for _, ... | Use absolute import in test | Use absolute import in test
| Go | bsd-2-clause | ninchat/maxreader |
5f250647f4e9bad5178ad40d10b29cd3b56a5cdd | server/server.go | server/server.go | package server
import (
"net"
"net/http"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
)
// Server provides the web UI for interacting with the application. Users can
// login, post suggestions, and queue items if they have the appropriate
// permissions.
type Server struct {
listener net.Listener
log ... | package server
import (
"net"
"net/http"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
)
// Server provides the web UI for interacting with the application. Users can
// login, post suggestions, and queue items if they have the appropriate
// permissions.
type Server struct {
listener net.Listener
log ... | Add route for static files. | Add route for static files.
| Go | mit | ReformedDevs/anonbot,ReformedDevs/anonbot,ReformedDevs/anonbot |
e9092f3eb01a42b95ab9f597f35c875f42097543 | shared/generate/file/path.go | shared/generate/file/path.go | package file
import (
"log"
"path/filepath"
"runtime"
"strings"
)
// Given its relative path with respect to the LXD surce tree, return the full
// path of a file.
func absPath(path string) string {
// We expect to be called by code within the lxd package itself.
_, filename, _, _ := runtime.Caller(1)
elems :... | package file
import (
"log"
"path/filepath"
"runtime"
"strings"
)
// Given its relative path with respect to the LXD surce tree, return the full
// path of a file.
func absPath(path string) string {
// We expect to be called by code within the lxd package itself.
_, filename, _, _ := runtime.Caller(1)
elems :... | Fix regression caused by Fatalf fix | shared/generate: Fix regression caused by Fatalf fix
Signed-off-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>
| Go | apache-2.0 | hallyn/lxd,Skarlso/lxd,hallyn/lxd,Skarlso/lxd,lxc/lxd,stgraber/lxd,mjeanson/lxd,stgraber/lxd,atxwebs/lxd,lxc/lxd,stgraber/lxd,mjeanson/lxd,atxwebs/lxd,lxc/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd,hallyn/lxd,Skarlso/lxd,stgraber/lxd,atxwebs/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,lxc/lxd,mjeanson/lxd,hallyn/lxd,atxwebs/lxd,lxc/l... |
d88c143068752c24375a23ed48434604499b2422 | slackapi_test.go | slackapi_test.go | package slackapi
import (
"encoding/json"
"testing"
)
func CheckResponse(t *testing.T, x interface{}, y string) {
out, err := json.Marshal(x)
if err != nil {
t.Fatal("json fromat;", err)
}
if string(out) != y {
t.Fatalf("invalid json response;\n- %s\n+ %s\n", y, out)
}
}
func TestAPITest(t *testing.T) {
... | package slackapi
import (
"encoding/json"
"testing"
)
func CheckResponse(t *testing.T, x interface{}, y string) {
out, err := json.Marshal(x)
if err != nil {
t.Fatal("json fromat;", err)
}
if string(out) != y {
t.Fatalf("invalid json response;\n- %s\n+ %s\n", y, out)
}
}
func TestAPITest(t *testing.T) {
... | Remove auth.test unit test due to API uncertanties | Remove auth.test unit test due to API uncertanties
| Go | mit | cixtor/slackapi |
d3e0b484e37ef86bb6c3597fd06a7f09685069e9 | track/http_client.go | track/http_client.go | // Copyright 2017 Eric Daniels
//
// 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 ... | // Copyright 2017 Eric Daniels
//
// 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 ... | Fix bug where ByteTrack in HTTPClient was a different tracker | Fix bug where ByteTrack in HTTPClient was a different tracker
| Go | apache-2.0 | edaniels/go-net-utils |
4a1385d1e00564d7e9147a799741dc339efecaf2 | flags.go | flags.go | package main
import (
"gopkg.in/alecthomas/kingpin.v2"
)
var (
host = kingpin.Flag("host", "Host to bind webserver to").Default("127.0.0.1").IP()
port = kingpin.Flag("port", "Port to bind webserver to").Default("2999").Int()
production = kingpin.Flag("production", "Run in production mode").Default("fa... | package main
import (
"gopkg.in/alecthomas/kingpin.v2"
)
var (
host = kingpin.Flag("host", "Host to bind webserver to").Default("127.0.0.1").IP()
port = kingpin.Flag("port", "Port to bind webserver to").Default("2015").Int()
production = kingpin.Flag("production", "Run in production mode").Default("fa... | Set default port to 2015 | Set default port to 2015
| Go | mit | lukevers/chitchat,lukevers/chitchat,lukevers/chitchat |
0086e97c4c7a2be68f8959ec1e1fbab96ca62e70 | engine/dot.go | engine/dot.go | package engine
import (
"encoding/json"
"fmt"
)
type Dot struct {
X uint8
Y uint8
}
// Equals compares two dots
func (d1 Dot) Equals(d2 Dot) bool {
return d1 == d2 || (d1.X == d2.X && d1.Y == d2.Y)
}
// Implementing json.Marshaler interface
func (d Dot) MarshalJSON() ([]byte, error) {
return json.Marshal([]ui... | package engine
import "fmt"
type Dot struct {
X uint8
Y uint8
}
// Equals compares two dots
func (d1 Dot) Equals(d2 Dot) bool {
return d1 == d2 || (d1.X == d2.X && d1.Y == d2.Y)
}
// Implementing json.Marshaler interface
func (d Dot) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("[%d,%d]", d.X, d.Y)... | Rewrite engine.Dot marshaler to use sprintf instead json.Marshal | Rewrite engine.Dot marshaler to use sprintf instead json.Marshal
| Go | bsd-2-clause | ivan1993spb/clever-snake |
32f3e4f293119178e819ad74f90f9b95706e1979 | utils/newline.go | utils/newline.go | // Some utility functions, which are classified to a certain package.
package utils
import "runtime"
var (
Mac = "\r"
Unix = "\n"
Windows = "\r\n"
)
var newlines map[string]string
func init() {
newlines = map[string]string{
"windows": Windows,
"darwin": Mac,
"linux": Unix,
"freebsd": Unix,
}
... | // Package utils supplys some utility functions, which are classified to a certain package.
package utils
import "runtime"
var (
// MacNL is the newline in Mac.
MacNL = "\r"
// UnixNL is the newline in Unix/Linux.
UnixNL = "\n"
// WindowsNL is the newline in Windows.
WindowsNL = "\r\n"
)
var newlines map[str... | Update the comment of the package utils. | Update the comment of the package utils.
Change Mac, Unix, Windows to MacNL, UnixNL, WindowsNL.
| Go | apache-2.0 | xgfone/go-tools |
dd426f20f24823c89e46f815c91d1846b2ff7c83 | client/main.go | client/main.go | package main
import (
"fmt"
"io/ioutil"
"runtime"
"github.com/shurcooL/trayhost"
)
func main() {
runtime.LockOSThread()
menuItems := trayhost.MenuItems{
trayhost.MenuItem{
Title: "Instant Share",
Handler: func() {
fmt.Println("TODO: grab content, content-type of clipboard")
fmt.Println("TODO: ... | package main
import (
"fmt"
"io/ioutil"
"runtime"
"github.com/shurcooL/trayhost"
)
func main() {
runtime.LockOSThread()
menuItems := []trayhost.MenuItem{
trayhost.MenuItem{
Title: "Instant Share",
Handler: func() {
fmt.Println("TODO: grab content, content-type of clipboard")
fmt.Println("TODO:... | Update to upstream API change. | client: Update to upstream API change. | Go | mit | pavben/InstantShare,pavben/InstantShare |
3434e00fe6939d20d76fa7d05a9288c7b1d7a1f3 | gateway/internal/gateway/frontend/hmac.go | gateway/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,cvmfs/cvmfs,DrDaveD/cvmfs,DrDaveD/cvmfs,DrDaveD/cvmfs,DrDaveD/cvmfs,cvmfs/cvmfs,DrDaveD/cvmfs,DrDaveD/cvmfs,cvmfs/cvmfs,cvmfs/cvmfs,cvmfs/cvmfs,DrDaveD/cvmfs,cvmfs/cvmfs |
d3af75c6eb6e143bc0f887a5993a9a6a3c700857 | example/point/point.go | example/point/point.go | package main
import (
"fmt"
"log"
"github.com/yofu/dxf"
"github.com/yofu/dxf/entity"
)
func main() {
dr, err := dxf.Open("point.dxf")
if err != nil {
log.Fatal(err)
}
for _, e := range dr.Entities() {
if p, ok := e.(*entity.Point); ok {
fmt.Println(p.Coord)
}
}
}
| package main
import (
"fmt"
"log"
"github.com/yofu/dxf"
"github.com/yofu/dxf/entity"
)
func main() {
dr, err := dxf.FromFile("point.dxf")
if err != nil {
log.Fatal(err)
}
for _, e := range dr.Entities() {
if p, ok := e.(*entity.Point); ok {
fmt.Println(p.Coord)
}
}
}
| Move to new func name | Move to new func name
| Go | mit | yofu/dxf |
8d834e22da1d8159ec61c9ee6a9a6542ca30fbd3 | transform.go | transform.go | package imgwizard
import (
"bytes"
"image"
"image/png"
"net/http"
"github.com/foobaz/lossypng/lossypng"
"github.com/shifr/vips"
)
func Transform(img_buff *[]byte, ctx *Context) {
var err error
buf := new(bytes.Buffer)
debug("Detecting image type...")
iType := http.DetectContentType(*img_buff)
if !string... | package imgwizard
import (
"bytes"
"image"
"image/png"
"net/http"
"github.com/foobaz/lossypng/lossypng"
"github.com/shifr/vips"
)
func Transform(img_buff *[]byte, ctx *Context) {
var err error
buf := new(bytes.Buffer)
debug("Detecting image type...")
iType := http.DetectContentType(*img_buff)
if !string... | Check if browser accepts Webp instead of .png | Check if browser accepts Webp instead of .png
| Go | mit | shifr/imgwizard |
c47b3849a26b9129de9705726479f1606207abd9 | leetcode/129_sum_root_to_leaf_numbers.go | leetcode/129_sum_root_to_leaf_numbers.go | package leetcode
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
func sumNumbers(root *TreeNode) int {
if root == nil {
return 0
} else if root.Left == nil && root.Right == nil {
return root.Val
} else if root.Left == nil {... | package leetcode
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func sumNumbers(root *TreeNode) int {
if root == nil {
return 0
} else if root.Left == nil && root.Right == nil {
return root.Val
} else if root.Left == nil {
return sum(root.Right, root.Val)
} else if root.Right == nil {... | Add TreeNode to fix compile error | Add TreeNode to fix compile error
| Go | mit | motomux/go-algo |
089e34f010baf1bc46703001b0dd0f28a58523fd | isatty_bsd.go | isatty_bsd.go | // +build darwin freebsd openbsd netbsd
// +build !appengine
package isatty
import (
"syscall"
"unsafe"
)
const ioctlReadTermios = syscall.TIOCGETA
// IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.S... | // +build darwin freebsd openbsd netbsd dragonfly
// +build !appengine
package isatty
import (
"syscall"
"unsafe"
)
const ioctlReadTermios = syscall.TIOCGETA
// IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool {
var termios syscall.Termios
_, _, err := syscall.Syscall6... | Add dragonfly to bsd build | Add dragonfly to bsd build
Dragonfly is a BSD, too. | Go | mit | mattn/go-isatty,mattn/go-isatty |
23cd2122fd484005167117888c1c5b9247efcc40 | src/github.com/stellar/horizon/render/hal/main.go | src/github.com/stellar/horizon/render/hal/main.go | package hal
import (
"encoding/json"
"net/http"
)
// RenderToString renders the provided data as a json string
func RenderToString(data interface{}, pretty bool) ([]byte, error) {
if pretty {
return json.MarshalIndent(data, "", " ")
}
return json.Marshal(data)
}
// Render write data to w, after marshalling ... | package hal
import (
"encoding/json"
"net/http"
)
// RenderToString renders the provided data as a json string
func RenderToString(data interface{}, pretty bool) ([]byte, error) {
if pretty {
return json.MarshalIndent(data, "", " ")
}
return json.Marshal(data)
}
// Render write data to w, after marshalling ... | Add Content-Disposition header for hal responses | Add Content-Disposition header for hal responses
| Go | apache-2.0 | stellar/horizon,stellar/horizon,stellar/horizon |
3bdd4a4ec850eed0494d007fd41b665173415039 | csvp_test.go | csvp_test.go | package main
import (
"reflect"
"testing"
)
var parseIndexesListTests = []struct {
list string
indexes []int
}{
// Only one index
{
list: "10",
indexes: []int{10},
},
{
list: "120",
indexes: []int{120},
},
// Multiple indexes
{
list: "10,120",
indexes: []int{10, 120},
},
{
list... | package main
import (
"reflect"
"testing"
)
var parseIndexesListTests = []struct {
list string
indexes []int
}{
// Only one index
{
list: "10",
indexes: []int{10},
},
{
list: "120",
indexes: []int{120},
},
// Multiple indexes
{
list: "10,120",
indexes: []int{10, 120},
},
{
list... | Use Errorf instead of Error | Use Errorf instead of Error
| Go | mit | kusabashira/csvp |
34c6ce978ad576469ea43860fecc48fad612c7c8 | depacketizer.go | depacketizer.go | package rtp
// Depacketizer depacketizes a RTP payload, removing any RTP specific data from the payload
type Depacketizer interface {
Unmarshal(packet *Packet) ([]byte, error)
}
| package rtp
// Depacketizer depacketizes a RTP payload, removing any RTP specific data from the payload
type Depacketizer interface {
Unmarshal(packet []byte) ([]byte, error)
}
| Update Depacketizer interface to match codecs | Update Depacketizer interface to match codecs
Codecs were updated but interface was not breaking
the SampleBuilder
| Go | mit | pion/rtp |
82f38d10ceb089c70209019cfa39985743986dfa | def/parse.go | def/parse.go | package def
import (
"bytes"
"github.com/go-yaml/yaml"
"github.com/ugorji/go/codec"
"polydawn.net/repeatr/lib/cereal"
)
var codecBounceHandler = &codec.CborHandle{}
func ParseYaml(ser []byte) *Formula {
// Turn tabs into spaces so that tabs are acceptable inputs.
ser = cereal.Tab2space(ser)
// Bounce the se... | package def
import (
"bytes"
"github.com/go-yaml/yaml"
"github.com/ugorji/go/codec"
"polydawn.net/repeatr/lib/cereal"
)
var codecBounceHandler = &codec.CborHandle{}
func ParseYaml(ser []byte) *Formula {
// Turn tabs into spaces so that tabs are acceptable inputs.
ser = cereal.Tab2space(ser)
// Bounce the se... | Drop mention of what phase of parsing errored. | Drop mention of what phase of parsing errored.
These are... implementation details that are not at all meaningful to an end-user. And also still quite distinguishable if you really care enough to ask for full stacks by setting the DEBUG var.
Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultan... | Go | apache-2.0 | subuser-security/repeatr,polydawn/repeatr,polydawn/repeatr,subuser-security/repeatr |
19b02871d27a36a8d1c4aa22cf9257f5593cd4c3 | app.go | app.go | package main
import (
"./app/api"
"./app/controllers"
"./db"
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/render"
)
/**
* Connect to database.
*/
func dbConnection() {
db.Init()
db.CreateTables()
db.RunFixtures()
}
/**
* Load all Controllers.
*/
func loadControllers(app *marti... | package main
import (
"./app/api"
"./app/controllers"
"./db"
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/render"
)
/**
* Connect to database.
*/
func dbConnection() {
db.Init()
//db.CreateTables()
//db.RunFixtures()
//db.Migrate()
}
/**
* Load all Controllers.
*/
func loadCo... | Prepare and comment all database tasks. | Prepare and comment all database tasks.
| Go | mit | bhtz/go-web-boilerplate |
c9febb2239ed0f05fb24012a43e55e2a455fcef8 | cmd/danggit/danggit.go | cmd/danggit/danggit.go | package main
func main() {}
| package main
import (
"fmt"
"os"
"github.com/libgit2/git2go"
)
func main() {
repo, err := git.OpenRepository(".")
if err != nil {
fmt.Printf("not a repo: %s\n", err)
os.Exit(5)
}
desc, err := repo.DescribeWorkdir(&git.DescribeOptions{})
if err != nil {
fmt.Printf("madness: %s\n", err)
os.Exit(6)
}
... | Make some actual main method to play with. | Make some actual main method to play with.
Though it's clear that I don't have any idea how this describe method is meant to be used... it does actually work, and is presumably doing something slightly nontrivial.
Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us>
| Go | apache-2.0 | polydawn/danggit,polydawn/danggit |
c17f8758d9176b8efecba37540ceacc8378d8e9d | webidl/parser/nodetype_string.go | webidl/parser/nodetype_string.go | // generated by stringer -type=NodeType; DO NOT EDIT
package parser
import "fmt"
const _NodeType_name = "NodeTypeErrorNodeTypeGlobalModuleNodeTypeFileNodeTypeCommentNodeTypeCustomOpNodeTypeAnnotationNodeTypeParameterNodeTypeDeclarationNodeTypeMemberNodeTypeImplementationNodeTypeTagged"
var _NodeType_index = [...]ui... | // Code generated by "stringer -type=NodeType"; DO NOT EDIT
package parser
import "fmt"
const _NodeType_name = "NodeTypeErrorNodeTypeGlobalModuleNodeTypeGlobalDeclarationNodeTypeFileNodeTypeCommentNodeTypeCustomOpNodeTypeAnnotationNodeTypeParameterNodeTypeDeclarationNodeTypeMemberNodeTypeImplementationNodeTypeTagged... | Update WebIDL parser node type | Update WebIDL parser node type
| Go | bsd-3-clause | Serulian/compiler,Serulian/compiler |
a824d28ae5936586b5045b56e42462c1f8d0f00b | main_check.go | main_check.go | package main
import (
"fmt"
"github.com/libgit2/git2go"
"github.com/urfave/cli"
)
func GitSeekretCheck(c *cli.Context) error {
err := gs.LoadConfig(true)
if git.IsErrorClass(err, git.ErrClassConfig) {
return fmt.Errorf("Config not initialised - Try: 'git-seekret config --init'")
}
if err != nil {
return er... | package main
import (
"fmt"
"github.com/libgit2/git2go"
"github.com/urfave/cli"
)
func GitSeekretCheck(c *cli.Context) error {
err := gs.LoadConfig(true)
if git.IsErrorClass(err, git.ErrClassConfig) {
return fmt.Errorf("Config not initialised - Try: 'git-seekret config --init'")
}
if err != nil {
return er... | Fix options for check subcommand for staged files and commits | Fix options for check subcommand for staged files and commits
| Go | apache-2.0 | apuigsech/git-seekret |
91fb95b9683221d032051bf4d0f79eb422bb232d | routes/routes.go | routes/routes.go | package routes
import (
"github.com/DVI-GI-2017/Jira__backend/handlers"
)
func InitRouter(r *router) {
r.Post("/signup", handlers.RegisterUser)
r.Post("/signin", handlers.Login)
}
| package routes
import (
"log"
"github.com/DVI-GI-2017/Jira__backend/handlers"
)
func InitRouter(r *router) {
const signup = "/signup"
err := r.Post(signup, handlers.RegisterUser)
if err != nil {
log.Panicf("can not init route '%s': %v", signup, err)
}
const signin = "/signin"
err = r.Post(signin, handlers... | Add more verbose check when adding new route. | Add more verbose check when adding new route.
| Go | mit | DVI-GI-2017/Jira__backend |
a067b0b7ac91706b464911da1b0ad52ee7ebfa6b | server/server_status.go | server/server_status.go | package server
import (
"github.com/gocraft/web"
"runtime"
)
type serverStatus struct {
*APIContext
}
func SetUpServerStatusRouter(prefix string, router *web.Router) {
root := router.Subrouter(serverStatus{}, "/runtime_status")
root.Get("/", (*serverStatus).Index)
}
func (ss *serverStatus) Index(rw web.Respons... | package server
import (
"github.com/gocraft/web"
"runtime"
)
type serverStatus struct {
*APIContext
}
func SetUpServerStatusRouter(prefix string, router *web.Router) {
root := router.Subrouter(serverStatus{}, "")
root.Get("/runtime_status", (*serverStatus).RuntimeStatus)
}
func (ss *serverStatus) RuntimeStatus... | Fix Subrouter pathPrefix of serverStatus controller | Fix Subrouter pathPrefix of serverStatus controller
| Go | mit | sensorbee/sensorbee,sensorbee/sensorbee |
c036b8559e2e456aacd23066b0cbed71888c3cb2 | units.go | units.go | //
// Use and distribution licensed under the Apache license version 2.
//
// See the COPYING file in the root project directory for full text.
//
package ghw
var (
KB int64 = 1024
MB int64 = KB * 1024
GB int64 = MB * 1024
TB int64 = GB * 1024
PB int64 = TB * 1024
EB int64 = PB * 1024
)
func unitWithString(siz... | //
// Use and distribution licensed under the Apache license version 2.
//
// See the COPYING file in the root project directory for full text.
//
package ghw
var (
KB int64 = 1024
MB = KB * 1024
GB = MB * 1024
TB = GB * 1024
PB = TB * 1024
EB = PB * 1024
)
func unitWithString(siz... | Fix up unit.go lint nits | Fix up unit.go lint nits
| Go | apache-2.0 | jaypipes/ghw,jaypipes/ghw |
1a738ab5124ec1b5f5b08c1e71bb5c650ddb4529 | pkg/authorization/authorizer/adapter/authorizer.go | pkg/authorization/authorizer/adapter/authorizer.go | package adapter
import (
"errors"
"github.com/golang/glog"
kauthorizer "k8s.io/kubernetes/pkg/auth/authorizer"
oauthorizer "github.com/openshift/origin/pkg/authorization/authorizer"
)
type AdapterAuthorizer struct {
originAuthorizer oauthorizer.Authorizer
}
// NewAuthorizer adapts an Origin Authorizer interf... | package adapter
import (
"github.com/golang/glog"
kauthorizer "k8s.io/kubernetes/pkg/auth/authorizer"
oauthorizer "github.com/openshift/origin/pkg/authorization/authorizer"
)
type AdapterAuthorizer struct {
originAuthorizer oauthorizer.Authorizer
}
// NewAuthorizer adapts an Origin Authorizer interface to a Ku... | Simplify AuthorizationAdapter now that upstream matches our signature | Simplify AuthorizationAdapter now that upstream matches our signature
| Go | apache-2.0 | imcsk8/origin,hroyrh/origin,liangxia/origin,dgoodwin/origin,chmouel/origin,php-coder/origin,stevekuznetsov/origin,soltysh/origin,dgoodwin/origin,jeremyeder/origin,thrasher-redhat/origin,coreydaley/origin,danmcp/origin,enj/origin,hroyrh/origin,rhamilto/origin,dcbw/origin,tnozicka/origin,rajatchopra/origin,ironcladlou/or... |
b401af4f131d4b70e99d29a189b574b14fcc7002 | pkg/migration/3_etcdbr_create_storage_container.go | pkg/migration/3_etcdbr_create_storage_container.go | package migration
import (
"k8s.io/client-go/kubernetes"
v1 "github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
"github.com/sapcc/kubernikus/pkg/client/openstack"
"github.com/sapcc/kubernikus/pkg/util"
etcd_util "github.com/sapcc/kubernikus/pkg/util/etcd"
)
func CreateEtcdBackupStorageContainer(rawKluster []by... | package migration
import (
"errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
"github.com/sapcc/kubernikus/pkg/client/openstack"
etcd_util "github.com/sapcc/kubernikus/pkg/util/etcd"
)
func CreateEtcdBackupStorageContainer(... | Revert migration version 3 to previous state | Revert migration version 3 to previous state
| Go | apache-2.0 | sapcc/kubernikus,sapcc/kubernikus,sapcc/kubernikus |
fe0fd23b2c499738117e1f0b7893f19ce17db87a | x/validator/keeper/keeper.go | x/validator/keeper/keeper.go | package keeper
import (
"fmt"
"math"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/zigbee-alliance/distributed-compliance-ledger/x/validator/types"
)
type (
Keeper struct {
cdc codec.BinaryCodec
storeKey sdk.Store... | package keeper
import (
"fmt"
"math"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/zigbee-alliance/distributed-compliance-ledger/x/validator/types"
)
type (
Keeper struct {
cdc codec.BinaryCodec
storeKey sdk.Store... | Add function for accumulating disable validator reject approvals count | Add function for accumulating disable validator reject approvals count
| Go | apache-2.0 | zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger |
444617bb2ef8c4a1221ef8b537d82deb69a5d631 | virtual_machine.go | virtual_machine.go | /*
Copyright (c) 2014 VMware, 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 or agreed t... | /*
Copyright (c) 2014 VMware, 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 or agreed t... | Add power on/off and reset functions to VirtualMachine | Add power on/off and reset functions to VirtualMachine
| Go | apache-2.0 | juju/govmomi,juju/govmomi,abathla/govmomi,mevansam/vsphere-govmomi,mevansam/vsphere-govmomi,ilikejam/govmomi,frapposelli/govmomi,jrmycanady/govmomi,abathla/govmomi,logankimmel/govmomi,higebu/govmomi,chrislovecnm/govmomi,higebu/govmomi,anexia-it/govmomi,pietern/govmomi,bruceadowns/govmomi,tkak/govmomi,caglar10ur/govmomi... |
5e6214b12d9a839ade379a270690b51ec41e7195 | otto/main.go | otto/main.go | package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"github.com/robertkrimen/otto"
"github.com/robertkrimen/otto/underscore"
)
var flag_underscore *bool = flag.Bool("underscore", true, "Load underscore into the runtime environment")
func readSource(filename string) ([]byte, error) {
if filename == "" || file... | package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"github.com/robertkrimen/otto/underscore"
"github.com/xyproto/otto"
)
var flag_underscore *bool = flag.Bool("underscore", true, "Load underscore into the runtime environment")
func readSource(filename string) ([]byte, error) {
if filename == "" || filename ... | Change the utility to use this repo, for testing | Change the utility to use this repo, for testing
| Go | mit | xyproto/otto,xyproto/otto |
a4cffbaf359a022748413daa22da03f5b4119265 | misc/schools.go | misc/schools.go | package misc
var Schools = map[string][]string{
"Da Vinci Communications": []string{
"davinci communications",
},
"El Segundo High School": []string{
"es",
"eshs",
"el segundo",
"gundo",
},
"Harbor Teacher Preparation Academy": []string{
"htpa",
},
"Hawthorne Math and Science Academy": []string{
"... | package misc
var Schools = map[string][]string{
"Da Vinci Communications": []string{
"davinci communications",
},
"El Segundo High School": []string{
"es",
"eshs",
"el segundo",
"gundo",
},
"Harbor Teacher Preparation Academy": []string{
"htpa",
},
"Hawthorne Math and Science Academy": []string{
"... | Add matchings for Lawndale High and South High. | Add matchings for Lawndale High and South High.
| Go | mit | zachlatta/southbayfession,zachlatta/southbayfession,zachlatta/southbayfession,zachlatta/southbayfession |
0f1cdb44d2b58baf46f4bade9def266c80484b88 | infrastructure/yaml.go | infrastructure/yaml.go | package infrastructure
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type Configuration struct {
Port string `yaml:"port"`
ClientID string `yaml:"clientID"`
ClientSecret string `yaml:"clientSecret"`
Scopes []string `yaml:"scopes,flow"`
}
func GetConfiguration(path string) (*Configuration, ... | package infrastructure
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type Configuration struct {
Port string `yaml:"port"`
ClientID string `yaml:"clientID"`
ClientSecret string `yaml:"clientSecret"`
Salt string `yaml:"salt"`
Host string `yaml:"host"`
Scopes []string `y... | Add new necessary configuration fields | Add new necessary configuration fields
| Go | mit | Tinker-Ware/gh-service |
f798c3e07c1e0764cc2e61b18ba1350a64a3138b | internal/goversion1.go | internal/goversion1.go | // Copyright 2016 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build go1
// +build !go1.6
package gb
const (
showGOTRACEBACKBanner = false
)
| // Copyright 2016 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build go1.1
// +build !go1.6
package internal
const (
showGOTRACEBACKBanner = false
)
| Fix build on go <=1.5. (bis) | Fix build on go <=1.5. (bis)
Totally shamecube worth.
| Go | apache-2.0 | maruel/panicparse,maruel/panicparse |
f46bbb57b12259dd409f010a797f4fc8f1785a91 | reuse_test.go | reuse_test.go | package reuseport
import (
"context"
"net"
"testing"
"github.com/stretchr/testify/require"
)
func testDialFromListeningPort(t *testing.T, network string) {
lc := net.ListenConfig{
Control: Control,
}
ctx := context.Background()
l1, err := lc.Listen(ctx, network, "localhost:0")
require.NoError(t, err)
l2,... | package reuseport
import (
"context"
"net"
"testing"
"github.com/stretchr/testify/require"
)
func testDialFromListeningPort(t *testing.T, network string) {
lc := net.ListenConfig{
Control: Control,
}
ctx := context.Background()
ll, err := lc.Listen(ctx, network, "localhost:0")
require.NoError(t, err)
rl,... | Make test variable names a little more specific | Make test variable names a little more specific
| Go | isc | libp2p/go-reuseport,jbenet/go-reuseport |
8d5b4250acac0edd78a23ab869df64fd33f206d6 | main.go | main.go | package main
import (
"log"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
ticker := time.NewTicker(10 * time.Second)
go func() {
for _ = range ticker.C {
log.Println("ping google.com -c 5")
res, err := ping("google.com", 5)
if err != nil {
log.Fatal(err)
}
log.Printf("Min: %f ms\n", re... | package main
import (
"container/ring"
"log"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
ring := ring.New(10)
ticker := time.NewTicker(10 * time.Second)
go func() {
for _ = range ticker.C {
log.Println("ping google.com -c 5")
res, err := ping("google.com", 5)
if err != nil {
log.Fatal(e... | Add ping results to ring buffer | Add ping results to ring buffer
| Go | mit | grahamrhay/go-ping,grahamrhay/go-ping |
88c5041300ef4670d5a6f2887f92243b57fa6be8 | main.go | main.go | package main
import (
"os"
slackreporter "github.com/ariarijp/horenso-reporter-slack/reporter"
"github.com/bluele/slack"
)
func main() {
token := os.Getenv("SLACK_TOKEN")
groupName := os.Getenv("SLACK_GROUP")
api := slack.New(token)
r := slackreporter.GetReport([]byte(os.Args[1]))
slackreporter.NotifyToGro... | package main
import (
"io/ioutil"
"os"
slackreporter "github.com/ariarijp/horenso-reporter-slack/reporter"
"github.com/bluele/slack"
)
func main() {
token := os.Getenv("SLACK_TOKEN")
groupName := os.Getenv("SLACK_GROUP")
stdin, err := ioutil.ReadAll(os.Stdin)
if err != nil {
panic(err)
}
api := slack.N... | Fix get the result JSON via STDIN | Fix get the result JSON via STDIN
| Go | mit | ariarijp/horenso-reporter-slack |
c75cb871fa03912dac7d3e94cf6decaeadfcba66 | stubs/go-nethttp/run.go | stubs/go-nethttp/run.go | package main
import (
"fmt"
"net/http"
"os"
"strings"
)
func main() {
if len(os.Args) == 4 {
fmt.Println("UNSUPPORTED")
os.Exit(0)
} else if len(os.Args) != 3 {
fmt.Printf("usage: %v <host> <port>\n", os.Args[0])
os.Exit(1)
}
url := "https://" + os.Args[1] + ":" + os.Args[2]
// Perform an HTTP(S) R... | package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
)
func main() {
if len(os.Args) < 3 || len(os.Args) > 4 {
fmt.Printf("usage: %v <host> <port> [cafile]\n", os.Args[0])
os.Exit(1)
}
client := http.DefaultClient
if len(os.Args) == 4 {
cadata, err := ioutil.R... | Add cafile support to the go-nethttp stub | Add cafile support to the go-nethttp stub
| Go | mit | ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls |
9d339268b019e7cf30818b5073899071aa39bf42 | webclient/handlers/logout/logout.go | webclient/handlers/logout/logout.go | package logouthandler
import (
"net/url"
"golang.org/x/net/context"
"github.com/flimzy/jqeventrouter"
"github.com/flimzy/log"
"github.com/gopherjs/gopherjs/js"
"github.com/gopherjs/jquery"
"github.com/FlashbackSRS/flashback/model"
)
var jQuery = jquery.NewJQuery
// BeforeTransition prepares the logout page... | package logouthandler
import (
"context"
"net/url"
"github.com/flimzy/jqeventrouter"
"github.com/flimzy/log"
"github.com/gopherjs/gopherjs/js"
"github.com/gopherjs/jquery"
"github.com/FlashbackSRS/flashback/model"
)
var jQuery = jquery.NewJQuery
// BeforeTransition prepares the logout page before display.
f... | Switch to proper context pacakge | Switch to proper context pacakge
| Go | mit | flimzy/flashback,FlashbackSRS/flashback,flimzy/flashback,flimzy/flashback,FlashbackSRS/flashback,FlashbackSRS/flashback |
69aaaa10381d9487ff3cf9990fca3780e895e450 | src/checks/consul_dns_check_test.go | src/checks/consul_dns_check_test.go | package checks_test
import (
. "checks"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Consul DNS checks", func() {
It("returns an error when host is not known", func() {
err := ConsulDnsCheck("host-non-existing.")
Expect(err).To(MatchError("Failed to resolve consul host host-non-e... | package checks_test
import (
. "checks"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Consul DNS checks", func() {
It("returns an error when host is not known", func() {
err := ConsulDnsCheck("non-existent.example.com.")
Expect(err.Error()).To(ContainSubstring("Failed to resolve c... | Fix consul dns check to not test OS specific messages | Fix consul dns check to not test OS specific messages
Signed-off-by: Ben Moss <80bec717c12290923c80384e0a5fc28cdf75a97e@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/hakim |
70b70c5a3272825063ecaef41ff2df41754e39c0 | state/utils/instance.go | state/utils/instance.go | // Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package utils
import (
"github.com/juju/errors"
"github.com/juju/juju/instance"
provcommon "github.com/juju/juju/provider/common"
"github.com/juju/juju/state"
)
// AvailabilityZone returns the availability zone associat... | // Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package utils
import (
"github.com/juju/errors"
"github.com/juju/juju/instance"
provcommon "github.com/juju/juju/provider/common"
"github.com/juju/juju/state"
)
// AvailabilityZone returns the availability zone associat... | Clean up an error message. | Clean up an error message.
| Go | agpl-3.0 | cherylj/juju,macgreagoir/juju,cherylj/juju,davecheney/juju,Altoros/juju-cloudsigma,tasdomas/juju,cloud-green/juju,wwitzel3/juju,alesstimec/juju,alesstimec/juju,axw/juju,tych0/juju,macgreagoir/juju,sinzui/juju,Altoros/juju-vmware,Altoros/juju-vmware,thomnico/juju,perrito666/juju,kat-co/juju,Altoros/juju-cloudsigma,mjs/j... |
f0115955b729476a7fa6dd9b86348b8630369e45 | tasks/03/sample_test.go | tasks/03/sample_test.go | package main
import (
"testing"
"github.com/fmi/go-homework/geom"
)
func TestSampleSimpleOperations(t *testing.T) {
var prim geom.Intersectable
a, b, c := geom.NewVector(-1, -1, 0), geom.NewVector(1, -1, 0), geom.NewVector(0, 1, 0)
prim = NewTriangle(a, b, c)
ray := geom.NewRay(geom.NewVector(0, 0, -1), geom.... | package main
import (
"testing"
"github.com/fmi/go-homework/geom"
)
func TestSampleSimpleOperations(t *testing.T) {
var prim geom.Intersectable
a, b, c := geom.NewVector(-1, -1, 0), geom.NewVector(1, -1, 0), geom.NewVector(0, 1, 0)
prim = NewTriangle(a, b, c)
ray := geom.NewRay(geom.NewVector(0, 0, -1), geom.... | Fix a wrong point in the task 03 sample test | Fix a wrong point in the task 03 sample test
The points in this particular test do not matter a lot but it was
creating the confusion that points for quads could be given in any
order.
| Go | mit | fmi/go-homework |
35686867c302bb155ed0f44f0a1d39975fa5c3c4 | util/struct_somautil.go | util/struct_somautil.go | package util
import "log"
type SomaUtil struct {
Log *log.Logger
}
func (u *SomaUtil) SetLog(l *log.Logger) {
u.Log = l
}
// vim: ts=4 sw=4 sts=4 noet fenc=utf-8 ffs=unix
| package util
import "log"
type SomaUtil struct {
Log *log.Logger
}
// vim: ts=4 sw=4 sts=4 noet fenc=utf-8 ffs=unix
| Kill last old logger function | Kill last old logger function
| Go | bsd-2-clause | 1and1/soma |
248f3205ac1f3cefa6255dbef9b8a5c77ffada1e | src/bosh-google-cpi/google/instance_service/google_instance_service_reboot.go | src/bosh-google-cpi/google/instance_service/google_instance_service_reboot.go | package instance
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
"bosh-google-cpi/api"
"bosh-google-cpi/util"
)
func (i GoogleInstanceService) Reboot(id string) error {
instance, found, err := i.Find(id, "")
if err != nil {
return err
}
if !found {
return api.NewVMNotFoundError(id)
}
i.log... | package instance
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
"bosh-google-cpi/api"
"bosh-google-cpi/util"
)
const (
STATUS_RUNNING = "RUNNING"
STATUS_TERMINATED = "TERMINATED"
)
func (i GoogleInstanceService) Reboot(id string) error {
instance, found, err := i.Find(id, "")
if err != nil {... | Support reboot of TERMINATED VMs | google: Support reboot of TERMINATED VMs
The reboot function triggered by `bosh cck` only called the `reset` API
method. That method can't be called on an instance in the TERMINATED
state (which is the state of a preemptible VM that's been preempted).
This change uses `start` to boot a terminted VM, or `reset` for a
r... | Go | apache-2.0 | cloudfoundry-incubator/bosh-google-cpi-release,evandbrown/bosh-google-cpi-release,evandbrown/bosh-google-cpi-release,cloudfoundry-incubator/bosh-google-cpi-release,cloudfoundry-incubator/bosh-google-cpi-release,evandbrown/bosh-google-cpi-release,evandbrown/bosh-google-cpi-release,cloudfoundry-incubator/bosh-google-cpi-... |
9386b77427804d675a125c69c7f33f7224bf9642 | build_scheduler/go/get_build/main.go | build_scheduler/go/get_build/main.go | package main
import (
"flag"
"path"
"github.com/skia-dev/glog"
"go.skia.org/infra/go/auth"
"go.skia.org/infra/go/buildbucket"
"go.skia.org/infra/go/common"
)
var (
id = flag.String("id", "", "ID of the build to retrieve.")
workdir = flag.String("workdir", "workdir", "Working directory to use.")
)
func ... | package main
import (
"bytes"
"encoding/json"
"flag"
"path"
"github.com/skia-dev/glog"
"go.skia.org/infra/go/auth"
"go.skia.org/infra/go/buildbucket"
"go.skia.org/infra/go/common"
)
var (
id = flag.String("id", "", "ID of the build to retrieve.")
workdir = flag.String("workdir", "workdir", "Working di... | Make get_build print nice(r) JSON output | Make get_build print nice(r) JSON output
BUG=skia:
Review-Url: https://codereview.chromium.org/2183313008
| Go | bsd-3-clause | google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot |
0f8f060cef86344634d7cb185fdf26a51a240474 | gost.go | gost.go | package main
import (
"flag"
"github.com/MaximeD/gost/conf"
"github.com/MaximeD/gost/gist"
)
var baseUrl string = "https://api.github.com/"
// get command line arguments
var gistDescriptionFlag = flag.String("description", "", "Description of the gist")
var gistPrivateFlag = flag.Bool("private", false, "Tells if ... | package main
import (
"flag"
"fmt"
"github.com/MaximeD/gost/conf"
"github.com/MaximeD/gost/gist"
"os"
)
var baseUrl string = "https://api.github.com/"
// get command line arguments
var gistDescriptionFlag = flag.String("description", "", "Description of the gist")
var gistPrivateFlag = flag.Bool("private", fals... | ADD usage informations on command line | ADD usage informations on command line
If user supplied not files or arguments, the program ended like it was
normal and displayed no informations to the user on how he should have
used it.
Fix by adding information messages.
REF: #2
| Go | mit | MaximeD/gost |
f301ec621764427bbc53654300256c89df257fc6 | main.go | main.go | package main
import (
"flag"
"fmt"
"net/http"
"os"
"github.com/gorilla/handlers"
)
const VERSION = "0.1.0"
var clientDir string
func init() {
clientEnv := os.Getenv("CLIENT")
flag.StringVar(&clientDir, "client", clientEnv, "the directory where the client data is stored")
}
func main() {
flag.Parse()
fmt.P... | package main
import (
"flag"
"fmt"
"io"
"net/http"
"os"
)
const VERSION = "0.1.0"
var clientDir string
func init() {
clientEnv := os.Getenv("CLIENT")
flag.StringVar(&clientDir, "client", clientEnv, "the directory where the client data is stored")
}
func main() {
flag.Parse()
fmt.Printf("resolutionizerd %s... | Use a custom logging handler. | Use a custom logging handler.
| Go | mpl-2.0 | smkell/resolutionizerd |
021903d1ff70343a09e5cc8669c46a91187a68b7 | main.go | main.go | package main
import (
"flag"
"github.com/litl/galaxy/log"
)
var (
// Location of the default config.
// This will not be overwritten by shuttle.
defaultConfig string
// Location of the live config which is updated on every state change.
// The default config is loaded if this file does not exist.
stateConfi... | package main
import (
"flag"
"github.com/litl/galaxy/log"
)
var (
// Location of the default config.
// This will not be overwritten by shuttle.
defaultConfig string
// Location of the live config which is updated on every state change.
// The default config is loaded if this file does not exist.
stateConfi... | Add a build version to executables | Add a build version to executables
Use -v to print version info.
| Go | mit | litl/shuttle,jwilder/shuttle,joeshaw/shuttle |
18c550cae2ed9778e4f1201be47b220561e0537b | main.go | main.go | package main
import (
"os"
"os/signal"
"warcluster/config"
"warcluster/entities/db"
"warcluster/server"
)
var cfg config.Config
func main() {
go final()
defer final()
cfg.Load("config/config.gcfg")
db.Connect(cfg.Database.Network, cfg.Database.Host, cfg.Database.Port)
server.Start(cfg.Server.Host, cfg.Ser... | package main
import (
"os"
"os/signal"
"warcluster/config"
"warcluster/entities/db"
"warcluster/server"
"syscall"
)
var cfg config.Config
func main() {
go final()
cfg.Load("config/config.gcfg")
db.Connect(cfg.Database.Network, cfg.Database.Host, cfg.Database.Port)
server.Start(cfg.Server.Host, cfg.Server.... | Exit safely from most of the signals | Exit safely from most of the signals
| Go | mit | WarCluster/warcluster-server,WarCluster/warcluster-server |
ac32c28191724d75d45f2fed855ab5b701762888 | main.go | main.go | package main
import (
"fmt"
"net/http"
"os"
"runtime"
"bitbucket.org/tebeka/nrsc"
"github.com/alexcesaro/log"
"github.com/alexcesaro/log/golog"
)
var logger *golog.Logger
var storage storageHandler
func requestLog(handler http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *... | package main
import (
"flag"
"fmt"
"net/http"
"os"
"runtime"
"bitbucket.org/tebeka/nrsc"
"github.com/alexcesaro/log"
"github.com/alexcesaro/log/golog"
)
var logger *golog.Logger
var address *string
var storage storageHandler
func requestLog(handler http.Handler) http.Handler {
return http.HandlerFunc(fun... | Allow to specify custom host and port | Allow to specify custom host and port
| Go | apache-2.0 | pavel-paulau/perfdb,pavel-paulau/perfdb,pavel-paulau/perfkeeper |
180dbfc5c52c01243834401c569ac0390ca5e3f9 | append.go | append.go | package multierror
// Append is a helper function that will append more errors
// onto an Error in order to create a larger multi-error.
//
// If err is not a multierror.Error, then it will be turned into
// one. If any of the errs are multierr.Error, they will be flattened
// one level into err.
func Append(err error... | package multierror
// Append is a helper function that will append more errors
// onto an Error in order to create a larger multi-error.
//
// If err is not a multierror.Error, then it will be turned into
// one. If any of the errs are multierr.Error, they will be flattened
// one level into err.
func Append(err error... | Remove unneeded nil check in Append | Remove unneeded nil check in Append | Go | mpl-2.0 | strivecast/go-multierror,hashicorp/go-multierror,mspiegel/go-multierror |
7b77ca60d0b59a265f8b681cd1d9eb4abc981902 | main.go | main.go | package main
import (
"fmt"
"os"
"path/filepath"
"github.com/gmcnaughton/gofindhdr/findhdr"
)
func main() {
inpath := "/Users/gmcnaughton/Pictures/Photos Library.photoslibrary/Masters/2017/02"
// inpath := "./test"
outpath := "./out"
optlink := true
// Create output folder
_ = os.Mkdir(outpath, ... | package main
import (
"fmt"
"os"
"path/filepath"
"github.com/gmcnaughton/gofindhdr/findhdr"
)
func main() {
// inpath := "/Users/gmcnaughton/Pictures/Photos Library.photoslibrary/Masters/2017/02"
inpath := "./test"
outpath := "./out"
optlink := false
// Create output folder
if optlink {
err ... | Support preview mode (don't link, just print matches found) | Support preview mode (don't link, just print matches found)
| Go | mit | gmcnaughton/findhdr |
53ec43d6cc4beb9c37dbd4a711dee1e254df3268 | main.go | main.go | package main
import (
log "github.com/Sirupsen/logrus"
"github.com/helphone/importer/job"
"github.com/robfig/cron"
)
func refresh() {
job.PullRepo()
job.Refresh()
}
func main() {
log.Info("Importer stared")
c := cron.New()
c.AddFunc("@every 1m", refresh)
c.Start()
refresh()
select {}
}
| package main
import (
log "github.com/Sirupsen/logrus"
"github.com/helphone/importer/job"
"github.com/robfig/cron"
)
func refresh() {
job.PullRepo()
job.Refresh()
}
func main() {
log.Info("Importer stared")
c := cron.New()
c.AddFunc("@every 1h", refresh)
c.Start()
refresh()
select {}
}
| Stop refreshing every minutes to hours | Stop refreshing every minutes to hours
| Go | mit | helphone/importer,helphone/importer |
caed85323c605cf884ca58db74c86d113a8df6d6 | main.go | main.go | package main
import (
"flag"
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
func main() {
var apply bool
var dryrun bool
flag.BoolVar(&apply, "apply", false, "apply to CloudWatch Events")
flag.BoolVar(&dryrun, "dry-run", false, "dry-run")
flag.Parse()
... | package main
import (
"flag"
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
func main() {
var apply bool
var dryrun bool
flag.BoolVar(&apply, "apply", false, "apply to CloudWatch Events")
flag.BoolVar(&dryrun, "dry-run", false, "dry-run")
flag.Parse()
... | Create session (catch the error) | Create session (catch the error)
| Go | mit | unasuke/maekawa |
15a23a8bfa110ad992499bc754f958a05f17ed5f | main.go | main.go | package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// Read in the config file
confText, err := ioutil.ReadFile("gologgen.conf")
if err != nil {
return
}
// Unmarshal the JSON into a map
var cd map[string]string
err2 := json.Unmarshal(confText, &cd)
if err2 != ni... | package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
func main() {
// Read in the config file
confText, err := ioutil.ReadFile("gologgen.conf")
if err != nil {
return
}
// Unmarshal the JSON into a map
var cd map[string]string
err2 := json.Unmarshal(confText, &cd)
if err2 != ni... | Use the logger instead of printing to console | Use the logger instead of printing to console
| Go | mit | FTWynn/gologgen |
6137a9cbaaad766305faa3cf9157362d014d28b7 | src/client.go | src/client.go | package main
import (
"log"
"github.com/gorilla/websocket"
"github.com/markbates/goth"
)
// Message emitted by a client and broadcasted to the channel
type Message struct {
User string `json:"user"`
Content string `json:"content"`
}
// Client is a middleman between the WebSocket connection and the Hub
type Clie... | package main
import (
"log"
"github.com/gorilla/websocket"
"github.com/markbates/goth"
)
// Message emitted by a client and broadcasted to the channel
type Message struct {
UserID string `json:"id"`
UserName string `json:"user"`
UserAvatar string `json:"avatar"`
Content string `json:"content"`
}
// Client is ... | Send ID and avatar URL with each Message | Send ID and avatar URL with each Message
| Go | mit | AntonioVdlC/chat,AntonioVdlC/chat,AntonioVdlC/chat |
1acc8a33558bd0f492eb230e0faec4ebd32b15a4 | client/driver/executor/executor_windows.go | client/driver/executor/executor_windows.go | package executor
func (e *UniversalExecutor) LaunchSyslogServer(ctx *ExecutorContext) (*SyslogServerState, error) {
return nil, nil
}
| package executor
import (
"os/exec"
"time"
"golang.org/x/sys/windows"
)
func (e *UniversalExecutor) LaunchSyslogServer(ctx *ExecutorContext) (*SyslogServerState, error) {
return nil, nil
}
func (e *UniversalExecutor) wait() {
defer close(e.processExited)
err := e.cmd.Wait()
ic := &cstructs.IsolationConfig{Cg... | Implement a Windows-specific UniversalExecutor `wait()` | Implement a Windows-specific UniversalExecutor `wait()`
| Go | mpl-2.0 | dvusboy/nomad,burdandrei/nomad,diptanu/nomad,jorgemarey/nomad,hooklift/nomad,Ashald/nomad,jorgemarey/nomad,nak3/nomad,diptanu/nomad,barnardb/nomad,frundh/nomad,jorgemarey/nomad,iverberk/nomad,frundh/nomad,iverberk/nomad,xytis/nomad,Ashald/nomad,barnardb/nomad,kmalec/nomad,dbresson/nomad,hooklift/nomad,achanda/nomad,ive... |
27d6322eda35d7eefe79eb2a1a5cd26fa36ab155 | git/remote.go | git/remote.go | package git
import (
"errors"
"regexp"
)
type GitRemote struct {
Name string
URL string
}
func Remotes() ([]GitRemote, error) {
r := regexp.MustCompile("(.+)\t(.+github.com.+) \\(push\\)")
output, err := execGitCmd("remote", "-v")
if err != nil {
return nil, errors.New("Can't load git remote")
}
remotes... | package git
import (
"errors"
"regexp"
)
type GitRemote struct {
Name string
URL string
}
func Remotes() ([]*GitRemote, error) {
r := regexp.MustCompile("(.+)\t(.+github.com.+) \\(push\\)")
output, err := execGitCmd("remote", "-v")
if err != nil {
return nil, errors.New("Can't load git remote")
}
remote... | Use pointers to be more efficient | Use pointers to be more efficient
| Go | mit | jingweno/gh,jingweno/gh,beni55/gh,beni55/gh,beni55/gh,jingweno/gh |
a2bb8bc323d62d7b534160fd30d46408d1f3e040 | engine_windows_test.go | engine_windows_test.go | package main
import "testing"
func TestDockerize(*testing.T) {
const expected = "/c/users/Foo"
var dockerized string
dockerized, err := dockerize(`C:\users\Foo`)
if err != nil {
t.Error("Unexpected error: ", err)
}
if dockerized != expected {
t.Error("Expected '", expected, "', got '", dockerized, "'")
... | package main
import "testing"
func TestDockerize(t *testing.T) {
const expected = "/c/users/Foo"
var dockerized string
dockerized, err := dockerize(`C:\users\Foo`)
if err != nil {
t.Error("Unexpected error: ", err)
}
if dockerized != expected {
t.Error("Expected '", expected, "', got '", dockerized, "'")... | Fix Windows Docker path test (missing param) | test: Fix Windows Docker path test (missing param)
| Go | apache-2.0 | coduno/piper,coduno/compute |
5f5b49955ceecfc37ba6206c811b998be303f8af | command/snapshot/inspect/formatter_test.go | command/snapshot/inspect/formatter_test.go | package inspect
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestFormat(t *testing.T) {
m := []typeStats{{
Name: "msg",
Sum: 1,
Count: 2,
}}
info := OutputFormat{
Meta: &MetadataInfo{
ID: "one",
Size: 2,
Index: 3,
Term: 4,
Version: 1,
},
Stats... | package inspect
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestFormat(t *testing.T) {
m := []typeStats{{
Name: "msg",
Sum: 1,
Count: 2,
}}
mkv := []typeStats{{
Name: "msgKV",
Sum: 1,
Count: 2,
}}
info := OutputFormat{
Meta: &MetadataInfo{
ID: "one",
S... | Update snapshot inspect formatter test | Update snapshot inspect formatter test
| Go | mpl-2.0 | hashicorp/consul,hashicorp/consul,hashicorp/consul,hashicorp/consul |
5c22f1f14629a4e3396833c2c6dd52634ebcd43e | src/graph/invitation.go | src/graph/invitation.go | package graph
import (
// "os"
)
type Invitation struct {
Name string
ID string
// rsvp_status, not_replied, attending, unsure or declined
RSVPStatus string
}
/*
func GetInvitations(URL string) (invs []Invitation, err os.Error) {
// TODO: Check for valid ID
b, err := fetchPage(URL)
m, err := getJsonMap(b)
d... | package graph
import (
"os"
)
type Invitation struct {
Name string
ID string
// rsvp_status, not_replied, attending, unsure or declined
RSVPStatus string
}
func getInvitations(url string) (invs []Invitation, err os.Error) {
data, err := getData(url)
if err != nil {
return
}
for i, v := range data {
in... | Change Invitation to the new OO design. | Change Invitation to the new OO design.
| Go | mit | mattn/go-facebook |
e1d45906ed38c71831fe61720f3df9d8a7061c98 | handler/loader.go | handler/loader.go | package handler
import (
"github.com/materials-commons/config/cfg"
)
type loaderHandler struct {
handler cfg.Handler
loader cfg.Loader
}
// Loader returns a handler that reads the keys in from a loader.
func Loader(loader cfg.Loader) cfg.Handler {
return &loaderHandler{
handler: Map(),
loader: loader,
}
}... | package handler
import (
"github.com/materials-commons/config/cfg"
)
type loaderHandler struct {
handler cfg.Handler
loader cfg.Loader
}
// Loader returns a handler that reads the keys in from a loader.
func Loader(loader cfg.Loader) cfg.Handler {
return &loaderHandler{
loader: loader,
}
}
// Init loads the... | Update the Loader handler to use the new MapUse handler. | Update the Loader handler to use the new MapUse handler.
| Go | mit | materials-commons/config,materials-commons/config |
492976aee59cf1b87150381a2733bb88bc7c12a1 | bolus.go | bolus.go | package medtronic
import (
"fmt"
"log"
)
const (
maxBolus = 25000 // milliUnits
)
// Bolus delivers the given amount of insulin as a bolus.
func (pump *Pump) Bolus(amount Insulin) {
if amount < 0 {
pump.SetError(fmt.Errorf("bolus amount (%d) is negative", amount))
}
if amount > maxBolus {
pump.SetError(fmt... | package medtronic
import (
"fmt"
"log"
)
const (
maxBolus = 25000 // milliUnits
)
// Bolus delivers the given amount of insulin as a bolus.
func (pump *Pump) Bolus(amount Insulin) {
if amount < 0 {
pump.SetError(fmt.Errorf("bolus amount (%d) is negative", amount))
}
if amount > maxBolus {
pump.SetError(fmt... | Return early if an error occurred | Return early if an error occurred
The subsequent Execute command won't do anything in an error state,
but this makes it obvious and provides another safety check.
| Go | mit | ecc1/medtronic,ecc1/medtronic |
2e40f383eb2bf9c4441cf69b0ae0c9f878b5eabb | termite/masterstats.go | termite/masterstats.go | package termite
import (
"fmt"
"http"
"sync"
"sync/atomic"
"time"
)
type masterStats struct {
counterMutex sync.Mutex
received *MultiResolutionCounter
running int32
}
func newMasterStats() *masterStats {
return &masterStats{
received: NewMultiResolutionCounter(1, time.Seconds(), []int{60, 10}),
}
}
... | package termite
import (
"fmt"
"http"
"sync"
"sync/atomic"
"time"
)
type masterStats struct {
counterMutex sync.Mutex
received *MultiResolutionCounter
running int32
}
func newMasterStats() *masterStats {
return &masterStats{
received: NewMultiResolutionCounter(1, time.Seconds(), []int{60, 10}),
}
}
... | Fix typo in HTML page. | Fix typo in HTML page.
| Go | bsd-3-clause | hanwen/termite,hanwen/termite,hanwen/termite |
c837377a7d0839c08c60b746cb7b826cdd3cca94 | logger.go | logger.go | package openzwave
import "fmt"
// A logger interface. Modelled on github.com/juju/loggo so that can be used substituted by default.
type Logger interface {
// Log an info message.
Infof(message string, args ...interface{})
// Log a warning message.
Warningf(message string, args ...interface{})
// Log an error me... | package openzwave
import "log"
// A logger interface. Modelled on github.com/juju/loggo so that can be used substituted by default.
type Logger interface {
// Log an info message.
Infof(message string, args ...interface{})
// Log a warning message.
Warningf(message string, args ...interface{})
// Log an error me... | Use log, rather than printf. | Use log, rather than printf.
| Go | mit | ninjasphere/go-openzwave,ninjasphere/go-openzwave,ninjasphere/go-openzwave,ninjasphere/go-openzwave,ninjasphere/go-openzwave,ninjasphere/go-openzwave |
0813e64388ec107581a3cfeea495a276d95a0db9 | src/server/pkg/testutil/ports.go | src/server/pkg/testutil/ports.go | package testutil
import "sync/atomic"
var nextPort uint32 = 40000
// UniquePort generates a likely unique port, so that multiple servers can run
// concurrently. Note that it does not actually check that the port is free,
// but uses atomics and a fairly highly port range to maximize the likelihood
// that the port ... | package testutil
import "sync/atomic"
var nextPort uint32 = 41300
// UniquePort generates a likely unique port, so that multiple servers can run
// concurrently. Note that it does not actually check that the port is free,
// but uses atomics and a fairly highly port range to maximize the likelihood
// that the port ... | Revert "Revert "Up the test port range"" | Revert "Revert "Up the test port range""
This reverts commit 228713acb8c952579be07f23249b0930c4bc49e5.
| Go | apache-2.0 | pachyderm/pfs,pachyderm/pfs,pachyderm/pfs |
d61adc880ea85c1adc4585afb2aac40ab1602f28 | cmd/pn/locking.go | cmd/pn/locking.go | package main
import (
"github.com/nightlyone/lockfile"
"os"
"path/filepath"
)
// Get name of lock file, which is derived from the monitoring event name
func getLockfileName() string {
return filepath.Join(os.TempDir(), monitoringEvent, monitoringEvent+".lock")
}
// Create a new lock file
func createLock() (lockf... | package main
import (
"github.com/nightlyone/lockfile"
"os"
"path/filepath"
)
// Create a new lock file
func createLock() (lockfile.Lockfile, error) {
filename := filepath.Join(os.TempDir(), "periodicnoise", monitoringEvent, monitoringEvent+".lock")
if err := os.MkdirAll(filepath.Dir(filename), 0700); err != ni... | Add "periodicnoise" to lock filename | Add "periodicnoise" to lock filename
| Go | mit | Jimdo/periodicnoise,Jimdo/periodicnoise |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.