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 |
|---|---|---|---|---|---|---|---|---|---|
e008eb93c6022895e60d0cfcd70faf5cf6bad9cf | provision/packet/delete.go | provision/packet/delete.go | package packet
import "github.com/spf13/cobra"
func deleteCmd() *cobra.Command {
cmd := &cobra.Command{}
return cmd
}
| package packet
import (
"errors"
"fmt"
"github.com/spf13/cobra"
)
func deleteCmd() *cobra.Command {
var deleteAll bool
cmd := &cobra.Command{
Use: "delete",
Short: "Delete machines from the Packet.net project. This will destroy machines. Be ready.",
Long: `Delete machines from the Packet.net project.
T... | Add support for deleting packet machines | Add support for deleting packet machines
| Go | apache-2.0 | sashajeltuhin/ket,apprenda/kismatic-provision,apprenda/kismatic-provision,sashajeltuhin/ket |
60a9a19ae0fcc57f1e100341b3d3117f8652582d | riak-cs-service/route_register_test.go | riak-cs-service/route_register_test.go | package riak_cs_service
import (
"github.com/cloudfoundry-incubator/cf-test-helpers/runner"
. "github.com/onsi/ginkgo"
)
var _ = Describe("Riak CS Nodes Register a Route", func() {
It("Allows users to access the riak-cs service using external url instead of IP of single machine after register the route", func() {
... | package riak_cs_service
import (
"github.com/cloudfoundry-incubator/cf-test-helpers/runner"
. "github.com/onsi/ginkgo"
)
var _ = Describe("Riak CS Nodes Register a Route", func() {
It("Allows users to access the riak-cs service using external url instead of IP of single machine after register the route", func() {
... | Replace hardcoded reference to http with https | Replace hardcoded reference to http with https
- This allows our tests to pass in deployments that do not allow http
traffic
[#101144102]
Signed-off-by: Lyle Franklin <31e283733c7a4b3b6cb03b95ab535671c2112bbe@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/cf-riak-cs-acceptance-tests,cloudfoundry-incubator/cf-riak-cs-acceptance-tests,cloudfoundry-incubator/cf-riak-cs-acceptance-tests |
cada5a8ba7b80987b2b3a935fcce1cef0f1d8294 | go/darts/darts.go | go/darts/darts.go | package darts
import "math"
func Score(x, y float64) int {
if isInnerCircle(x, y) {
return 10
} else if isMiddleCircle(x, y) {
return 5
} else if isOuterCircle(x, y) {
return 1
}
return 0
}
func isInnerCircle(x float64, y float64) bool {
return distanceToCenter(x, y) <= 1
}
func isMiddleCircle(x float64... | package darts
import "math"
const innerRadius = 1
const middleRadius = 5
const outerRadius = 10
func Score(x, y float64) int {
if isInCircle(x, y, innerRadius) {
return 10
} else if isInCircle(x, y, middleRadius) {
return 5
} else if isInCircle(x, y, outerRadius) {
return 1
}
return 0
}
func isInCircle(x... | Refactor to use one isInCircle func | Refactor to use one isInCircle func
| Go | mit | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism |
be97699700d8615a9b005065c34ae8ec981795bc | cf/api.go | cf/api.go | package cf
import (
"encoding/json"
"strings"
"time"
. "github.com/onsi/gomega"
"github.com/cloudfoundry-incubator/cf-test-helpers/runner"
)
//var CfApiTimeout = 30 * time.Second
type GenericResource struct {
Metadata struct {
Guid string `json:"guid"`
} `json:"metadata"`
}
type QueryResponse struct {
R... | package cf
import (
"encoding/json"
"strings"
"time"
. "github.com/onsi/gomega"
"github.com/cloudfoundry-incubator/cf-test-helpers/runner"
)
//var CfApiTimeout = 30 * time.Second
type GenericResource struct {
Metadata struct {
Guid string `json:"guid"`
} `json:"metadata"`
}
type QueryResponse struct {
R... | Update ApiRequest to not pass -d for empty data | Update ApiRequest to not pass -d for empty data
'cf curl' has changed such that passing -d for empty data is an error.
Signed-off-by: Kris Hicks <6d3f751023bc04266d4da2ff94804f4240839fe2@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/cf-test-helpers,cloudfoundry-incubator/cf-test-helpers |
e377444404f140bb5eff13b9cc38d8cc4b362b50 | background/background_linux.go | background/background_linux.go | package background
import (
"image"
"os/exec"
"os/user"
"path/filepath"
)
// Set the background on windows.
func Set(img image.Image) error {
// Get the absolute path of the directory.
usr, err := user.Current()
if err != nil {
return err
}
imgPath := filepath.Join(usr.HomeDir, ".local", "share", "himawari... | package background
import (
"image"
"os/exec"
"os/user"
"path/filepath"
)
// Set the background on windows.
func Set(img image.Image) error {
// Get the absolute path of the directory.
usr, err := user.Current()
if err != nil {
return err
}
imgPath := filepath.Join(usr.HomeDir, ".local", "share", "himawari... | Make primary-color consistent with image. | Make primary-color consistent with image.
| Go | mit | avinashbot/satellite |
e57e40302fb65a7786892ed00acce07d78887b8b | algoliasearch/types_key.go | algoliasearch/types_key.go | package algoliasearch
type Key struct {
ACL []string `json:"acl"`
CreatedAt int `json:"createdAt,omitempty"`
Description string `json:"description,omitempty"`
Indexes []string `json:"indexes,omitempty"`
MaxHitsPerQuery int `json:"maxHits... | package algoliasearch
type Key struct {
ACL []string `json:"acl"`
CreatedAt int `json:"createdAt,omitempty"`
Description string `json:"description,omitempty"`
Indexes []string `json:"indexes,omitempty"`
MaxHitsPerQuery int `json:"maxHits... | Add QueryParameters in Key struct to fix typo | fix(key): Add QueryParameters in Key struct to fix typo
| Go | mit | l4u/algoliasearch-client-go,l4u/algoliasearch-client-go,algolia/algoliasearch-client-go,algolia/algoliasearch-client-go |
382f308f68ed7dff07c6aabde76c609a5f1d63a5 | service/orm/orm_test.go | service/orm/orm_test.go | package orm
import "testing"
func TestOrm(t *testing.T) {
testConfig := map[string]interface{}{
"connection_string": "test_data/db/empty_test.db",
"driver": "sqlite3",
}
emptyDeps := make(map[string]interface{})
t.Run("Init", func(t *testing.T) {
_, err := Init(emptyDeps, testConfig)
if err !=... | package orm
import "testing"
import "github.com/mattn/go-sqlite3"
func TestOrm(t *testing.T) {
testConfig := map[string]interface{}{
"connection_string": "test_data/db/empty_test.db",
"driver": "sqlite3",
}
emptyDeps := make(map[string]interface{})
t.Run("InitInvalidConf", func(t *testing.T) {
c... | Change orm test to make it pass | Change orm test to make it pass
This makes it purposely use invalid data and expect an error. When we
have a better plan for testing database-related functionality, we can
add tests that use valid data.
| Go | agpl-3.0 | FriendlyLinuxPlayers/flip.earth |
05a2f8a91851774fea51766376b1a57ed5e00a07 | src/lib/builtins/equal.go | src/lib/builtins/equal.go | package builtins
import "github.com/coel-lang/coel/src/lib/core"
// Equal checks if all arguments are equal or not, and returns true if so or false otherwise.
var Equal = core.NewStrictFunction(
core.NewSignature(nil, nil, "args", nil, nil, ""),
func(ts ...*core.Thunk) core.Value {
l := ts[0]
if v := checkEmpt... | package builtins
import "github.com/coel-lang/coel/src/lib/core"
// Equal checks if all arguments are equal or not, and returns true if so or false otherwise.
var Equal = core.NewLazyFunction(
core.NewSignature(nil, nil, "args", nil, nil, ""),
func(ts ...*core.Thunk) core.Value {
l := ts[0]
if v := checkEmptyL... | Mark Equal function as lazy | Mark Equal function as lazy
| Go | mit | raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp,raviqqe/tisp |
daa3b000d9a9429cfab0d75802bf2a4d491ffdef | api/response.go | api/response.go | package api
// RootResponse object which will be formatted to json and sent back to google and onto the user.
type RootResponse struct {
ConversationToken string `json:"conversation_token"`
ExpectUserResponse bool `json:"expect_user_response"`
ExpectedInputs []ExpectedInput `json:"expected_... | package api
// RootResponse object which will be formatted to json and sent back to google and onto the user.
type RootResponse struct {
ConversationToken *string `json:"conversation_token"`
ExpectUserResponse bool `json:"expect_user_response"`
ExpectedInputs []ExpectedInput `json:"expected_... | Change conversation token to a pointer to allow it to be null in the json | Change conversation token to a pointer to allow it to be null in the json
| Go | apache-2.0 | wwsean08/go-action-sdk |
318da23a464cc6509b98f8bf7b92bfa57d9681f9 | fetcher/fetcher_test.go | fetcher/fetcher_test.go | package fetcher
import (
"fmt"
"testing"
"github.com/drkaka/lg"
)
func TestGetMessage(t *testing.T) {
lg.InitLogger(true)
jCmd := fmt.Sprintf("journalctl -u hooks -o json -n 20")
results, err := GetMessages("hooks", "ssh", "leeq@192.168.1.201", jCmd)
if err != nil {
t.Fatal(err)
}
for _, one := range re... | package fetcher
// func TestGetMessage(t *testing.T) {
// lg.InitLogger(true)
// jCmd := fmt.Sprintf("journalctl -u hooks -o json -n 20")
// results, err := GetMessages("hooks", "ssh", "leeq@192.168.1.201", jCmd)
// if err != nil {
// t.Fatal(err)
// }
// for _, one := range results {
// fmt.Println("Messa... | Comment out the fetcher test method. | Comment out the fetcher test method.
| Go | apache-2.0 | drkaka/j2es,drkaka/j2es |
2ae5492ccf7046960e337ccc6aff024216789b33 | backend/media/mediaservice.go | backend/media/mediaservice.go | package media
import (
"net/http"
"github.com/gorilla/mux"
"strconv"
"io/ioutil"
)
func GetMedia(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
f := vars["idMedia"]
idMedia, _ := strconv.Atoi(f)
if idMedia > 0 {
config, err := ioutil.ReadFile("data/media.config.json")
check(err)
if err... | package media
import (
"net/http"
"github.com/gorilla/mux"
"strconv"
"io/ioutil"
"encoding/json"
"errors"
)
var Medias []Media
func LoadMedias() {
content, err := ioutil.ReadFile("data/media.config.json")
check(err)
err = json.Unmarshal(content, &Medias)
check(err)
}
func GetMedia(idMedia int) (*Media, e... | Load medias configuration from memory | [Improve] Load medias configuration from memory
| Go | mit | Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL |
be7db019682845eda420a97b200ff7f9e46f0a59 | server/reverse_proxy.go | server/reverse_proxy.go | package server
import (
"github.com/vulcand/oxy/forward"
"github.com/vulcand/oxy/roundrobin"
"github.com/vulcand/oxy/stream"
"net/http"
"net/url"
)
type ReverseProxy struct {
stream *stream.Streamer
}
func NewReverseProxy(backends []string) *ReverseProxy {
fwd, _ := forward.New()
lb, _ := roundrobin.New(fwd)... | package server
import (
"github.com/vulcand/oxy/forward"
"github.com/vulcand/oxy/roundrobin"
"github.com/vulcand/oxy/stream"
"github.com/vulcand/oxy/cbreaker"
"net/http"
"net/url"
)
type ReverseProxy struct {
stream *stream.Streamer
}
func NewReverseProxy(backends []string) *ReverseProxy {
fwd, _ := forward.... | Add circuit breaker middle to revserse proxy | Add circuit breaker middle to revserse proxy
| Go | mit | xaviergodart/gydro |
dae33b296e2d4eb31debe67e29c75f8c99dc37e2 | lib/afp/types.go | lib/afp/types.go | // Copyright (c) 2010 AFP Authors
// This source code is released under the terms of the
// MIT license. Please see the file LICENSE for license details.
package afp
import (
"os"
"log"
)
const CHAN_BUF_LEN = 64
//Constants to specify the type of a given filter
const (
PIPE_SOURCE = iota
PIPE_SINK
PIPE_LINK
)
... | // Copyright (c) 2010 AFP Authors
// This source code is released under the terms of the
// MIT license. Please see the file LICENSE for license details.
package afp
import (
"os"
"log"
)
const CHAN_BUF_LEN = 64
//Constants to specify the type of a given filter
const (
PIPE_SOURCE = iota
PIPE_SINK
PIPE_LINK
)
... | Reformat HEADER_LENGTH calc slightly for readability | Reformat HEADER_LENGTH calc slightly for readability
| Go | mit | jesusaurus/afp,jesusaurus/afp,jesusaurus/afp,jesusaurus/afp |
1d4d34d481b33b5f0a2974081836ebdc40222376 | hoster_endpoint.go | hoster_endpoint.go | package gohost
// HosterEndpoint is an interface for an endpoint that can be hosted.
type HosterEndpoint interface {
// Serve hosts the endpoint.
Serve()
}
| package gohost
// HosterEndpoint is an interface for an endpoint that can be hosted.
type HosterEndpoint interface {
// Serve hosts the endpoint.
Serve() error
}
| Update interface to return an error. | Update interface to return an error.
| Go | mit | eleniums/gohost,eleniums/gohost |
553260f4c436e63495b3e84c56bdbe0e286fcd07 | lib/go/thrift/server.go | lib/go/thrift/server.go | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ma... | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ma... | Add SetLogger to the TServer interface | Add SetLogger to the TServer interface
| Go | apache-2.0 | upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift |
1e651aaa22a35bbcaaa1af4da0e05a674833ebdc | revparse_test.go | revparse_test.go | package git
| package git
import (
"fmt"
"os"
"testing"
)
func TestRevParseSingle(t *testing.T) {
repo := createTestRepo(t)
defer os.RemoveAll(repo.Workdir())
commitId, _ := seedTestRepo(t, repo)
fmt.Println(commitId)
revSpec, err := repo.RevParse("HEAD")
checkFatal(t, err)
checkObject(t, revSpec.From(), commitId)
}
... | Add simple test for `rev-parse HEAD`. | Add simple test for `rev-parse HEAD`.
| Go | mit | libgit2/git2go,orivej/git2go,tiborvass/git2go,treejames/git2go,clns/git2go,orivej/git2go,clearr/git2go,kissthink/git2go,TheDahv/git2go,clearr/git2go,michaeledgar/git2go,ezwiebel/git2go,ezwiebel/git2go,orivej/git2go,TheDahv/git2go,tiborvass/git2go,hwjeong/git2go,libgit2/git2go,clns/git2go,AaronO/git2go,pks-t/git2go,ezwi... |
9f15722635752cff394b669339c1f641a0723f44 | actor/actionerror/revision_not_found.go | actor/actionerror/revision_not_found.go | package actionerror
import "fmt"
// RevisionNotFoundError is returned when a requested application is not
// found.
type RevisionNotFoundError struct {
Version int
App string
}
func (e RevisionNotFoundError) Error() string {
return fmt.Sprintf("Revision '%d' for app '%s' not found", e.Version, e.App)
}
type ... | package actionerror
import "fmt"
// RevisionNotFoundError is returned when a requested application is not
// found.
type RevisionNotFoundError struct {
Version int
}
func (e RevisionNotFoundError) Error() string {
return fmt.Sprintf("Revision (%d) not found", e.Version)
}
type RevisionAmbiguousError struct {
Ver... | Change revision command error message format | Change revision command error message format
[#174107413](https://www.pivotaltracker.com/story/show/174107413)
Co-authored-by: Lisa Burns <bf777798bf9b27b432e8740a4233c0b7af91e7d5@vmware.com>
Co-authored-by: Alexander Berezovsky <a12e46294a7d630b60bbba114755367d6bafe2fb@vmware.com>
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
1309e7b9492d9a783287e327f592860a5d3f1ae9 | pkg/util/file.go | pkg/util/file.go | package util
import (
"fmt"
"io/ioutil"
)
// WriteTempFile creates a temporary file and returns its name
func WriteTempFile(prefix string, content string) string {
tmpFile, err := ioutil.TempFile("", "aptomi-"+prefix)
if err != nil {
panic("Failed to create temp file")
}
defer tmpFile.Close() // nolint: errch... | package util
import (
"fmt"
"io/ioutil"
)
// WriteTempFile creates a temporary file and returns its name
func WriteTempFile(prefix string, content string) string {
tmpFile, err := ioutil.TempFile("", "aptomi-"+prefix)
if err != nil {
panic("Failed to create temp file")
}
defer tmpFile.Close() // nolint: errch... | Remove no more used EnsureSingleFile helper | Remove no more used EnsureSingleFile helper
| Go | apache-2.0 | Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi |
a71e7dcd225a4ec00cbca7e1afd1b140f2078c29 | go/vt/callinfo/callinfo.go | go/vt/callinfo/callinfo.go | // Package callinfo stores custom values into the Context
// (related to the RPC source)
package callinfo
import (
"html/template"
"golang.org/x/net/context"
)
// CallInfo is the extra data stored in the Context
type CallInfo interface {
// RemoteAddr is the remote address information for this rpc call.
RemoteAd... | // Package callinfo stores custom values into the Context
// (related to the RPC source)
package callinfo
import (
"html/template"
"golang.org/x/net/context"
)
// CallInfo is the extra data stored in the Context
type CallInfo interface {
// RemoteAddr is the remote address information for this rpc call.
RemoteAd... | Use 0 as the context key | Use 0 as the context key
| Go | apache-2.0 | nurblieh/vitess,mattharden/vitess,SDHM/vitess,enisoc/vitess,cgvarela/vitess,netroby/vitess,mapbased/vitess,xgwubin/vitess,skyportsystems/vitess,kmiku7/vitess-annotated,cgvarela/vitess,erzel/vitess,davygeek/vitess,erzel/vitess,nurblieh/vitess,vitessio/vitess,fengshao0907/vitess,yangzhongj/vitess,enisoc/vitess,skyportsys... |
2d1da289e01d1518aac466cd12b76e7683bbe79a | cmd/sieve/main.go | cmd/sieve/main.go | package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"time"
"github.com/benbjohnson/sieve"
)
var (
addr = flag.String("addr", ":6900", "HTTP address")
)
func usage() {
fmt.Fprintln(os.Stderr, "usage: sieve [opts]")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
// Read configuration.
flag.Usage =... | package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"github.com/benbjohnson/sieve"
)
var (
addr = flag.String("addr", ":6900", "HTTP address")
)
func usage() {
fmt.Fprintln(os.Stderr, "usage: sieve [opts]")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
// Read configuration... | Add JSON parsing on STDIN. | Add JSON parsing on STDIN.
| Go | mit | benbjohnson/sieve,benbjohnson/sieve |
817c8271834c618ec99c6358b98c59a7537cefe7 | time_test.go | time_test.go | package main
import (
"testing"
)
func TestTimestampParser(t *testing.T) {
// nanoseconds
tsNano := ParseTimestamp("1411534805453497432")
if tsNano != 1411534805453497432 {
t.Errorf("Invalid ns: %v != %v", tsNano, 1411534805453497432)
}
// microseconds
tsNano = ParseTimestamp("1411534805453497")
if tsNano !... | package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTimestampParser(t *testing.T) {
tsNano := ParseTimestamp("1411534805453497432")
assert.Equal(t, tsNano, 1411534805453497432, "Invalid ns")
tsNano = ParseTimestamp("1411534805453497")
assert.Equal(t, tsNano, 1411534805453497000, "I... | Use testify package for unit testing | Use testify package for unit testing
| Go | apache-2.0 | pavel-paulau/perfkeeper,pavel-paulau/perfdb,pavel-paulau/perfdb |
9a0cb7bfca2739ea39a12569f517c77cb99188b1 | repos_handler.go | repos_handler.go | package main
import (
"html/template"
"log"
"net/http"
"time"
"github.com/andrewslotin/doppelganger/git"
)
var (
reposTemplate = template.Must(template.ParseFiles("templates/repos/index.html.template"))
)
type ReposHandler struct {
repositories git.RepositoryService
}
func NewReposHandler(repositoryService ... | package main
import (
"html/template"
"log"
"net/http"
"time"
"github.com/andrewslotin/doppelganger/git"
)
var (
reposTemplate = template.Must(template.ParseFiles("templates/repos/index.html.template"))
)
type ReposHandler struct {
repositories git.RepositoryService
}
func NewReposHandler(repositoryService ... | Fix typo in log message | Fix typo in log message
| Go | mpl-2.0 | andrewslotin/doppelganger |
4e5309381e73a3963cb2a82d3704bee4d8cfb73a | num/qpck/flags.go | num/qpck/flags.go | // Copyright 2016 The Gosl 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 qpck
/*
#cgo linux LDFLAGS: -lopenblas -llapack -lgfortran -lm
#cgo windows LDFLAGS: -lopenblas -lgfortran -lm
#cgo darwin LDFLAGS: -L/usr/local/op... | // Copyright 2016 The Gosl 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 qpck
/*
#cgo linux LDFLAGS: -lopenblas -llapack -lgfortran -lm
#cgo windows LDFLAGS: -lopenblas -lgfortran -lm
#cgo darwin LDFLAGS: -L/usr/local/op... | Update gfortran directory on macOS | Update gfortran directory on macOS
| Go | bsd-3-clause | cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl |
7629835c7e55ff035c2e5ac18e9cd927a8442bfc | cli/cli.go | cli/cli.go | package cli
import "fmt"
import (
"sync"
"github.com/jessevdk/go-flags"
)
var (
globalParser *flags.Parser
globalParserSetup sync.Once
)
func parser() *flags.Parser {
globalParserSetup.Do(func() {
globalParser = flags.NewNamedParser("cypress", flags.Default|flags.PassAfterNonOption)
})
return global... | package cli
import "fmt"
import (
"sync"
"github.com/jessevdk/go-flags"
)
var (
globalParser *flags.Parser
globalParserSetup sync.Once
)
func parser() *flags.Parser {
globalParserSetup.Do(func() {
globalParser = flags.NewNamedParser("cypress", flags.Default|flags.PassAfterNonOption)
})
return global... | Fix double printing the help output | Fix double printing the help output
| Go | bsd-3-clause | vektra/cypress,vektra/cypress |
77a854d793ee5bc1d0029497c3630316befd02df | src/subnet/constants.go | src/subnet/constants.go | package subnet
const (
//Queue from TUN -> router(server) / remote end (client)
pktInMaxBuff = 150
pktOutMaxBuff = 150
devMtuSize = 1500
devPktBuffSize = 4096
//Queue from network clients to ingestion
servMaxInboundPktQueue = 80
//Queue out to each network client
servPerClientPktQueue = 40
)
| package subnet
const (
//Queue from TUN -> router(server) / remote end (client)
pktInMaxBuff = 150
pktOutMaxBuff = 150
devMtuSize = 1500
devPktBuffSize = 4096
//Queue from network clients to ingestion
servMaxInboundPktQueue = 400
//Queue out to each network client
servPerClientPktQueue = 200
)
| Test increasing server queue sizes | Test increasing server queue sizes
| Go | mit | twitchyliquid64/subnet,twitchyliquid64/subnet |
9900d0380ada6a96b7cf50e847245943de9f65fa | backends_presenter.go | backends_presenter.go | package switchboard
import "encoding/json"
type backendsPresenter struct {
backends Backends
}
func NewBackendsPresenter(backends Backends) backendsPresenter {
return backendsPresenter{
backends: backends,
}
}
func (bp backendsPresenter) Present() ([]byte, error) {
backendsResponse := []string{}
for range bp... | package switchboard
import "encoding/json"
type backendsPresenter struct {
backends Backends
}
func NewBackendsPresenter(backends Backends) backendsPresenter {
return backendsPresenter{
backends: backends,
}
}
func (bp backendsPresenter) Present() ([]byte, error) {
backendsResponse := []string{}
for _ = rang... | Use 1.3.3. compatible syntax for now | Use 1.3.3. compatible syntax for now
[#81149294]
| Go | apache-2.0 | cloudfoundry-incubator/switchboard,cloudfoundry-incubator/switchboard,cloudfoundry-incubator/switchboard,cloudfoundry-incubator/switchboard |
eb44002a5429834ab9a2fb51c14a3847362cbd4c | cmd/edgectl/notify.go | cmd/edgectl/notify.go | package main
import (
"fmt"
"runtime"
"github.com/datawire/ambassador/pkg/supervisor"
)
var notifyRAI *RunAsInfo
// Notify displays a desktop banner notification to the user
func Notify(p *supervisor.Process, message string) {
if notifyRAI == nil {
var err error
notifyRAI, err = GuessRunAsInfo(p)
if err !... | package main
import (
"fmt"
"runtime"
"github.com/datawire/ambassador/pkg/supervisor"
)
var (
notifyRAI *RunAsInfo
notifyEnabled = false
)
// Notify displays a desktop banner notification to the user
func Notify(p *supervisor.Process, message string) {
p.Logf("---------------------------------------------... | Make it possible to disable notifications; disable them | Make it possible to disable notifications; disable them
| Go | apache-2.0 | datawire/ambassador,datawire/ambassador,datawire/ambassador,datawire/ambassador,datawire/ambassador |
531dfc22018fae9d6fa725a2090fed0b65bd5860 | pkg/api/customization/yaml/formatter.go | pkg/api/customization/yaml/formatter.go | package yaml
import (
"github.com/rancher/norman/types"
)
func NewFormatter(next types.Formatter) types.Formatter {
return func(request *types.APIContext, resource *types.RawResource) {
resource.Links["yaml"] = request.URLBuilder.Link("yaml", resource)
if next != nil {
next(request, resource)
}
}
}
| package yaml
import (
"github.com/rancher/norman/types"
)
func NewFormatter(next types.Formatter) types.Formatter {
return func(request *types.APIContext, resource *types.RawResource) {
if next != nil {
next(request, resource)
}
resource.Links["yaml"] = request.URLBuilder.Link("yaml", resource)
}
}
| Fix yaml link for workloads | Fix yaml link for workloads
| Go | apache-2.0 | rancher/rancher,cjellick/rancher,rancherio/rancher,cjellick/rancher,rancher/rancher,rancher/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher |
06fed06a31753a4f1e54e23a61f2896aaed63acf | sflow_listener.go | sflow_listener.go | package main
import (
"bytes"
"github.com/Cistern/sflow"
"net"
)
func sFlowParser(buffer []byte) {
reader := bytes.NewReader(buffer)
d := sflow.NewDecoder(reader)
dgram, err := d.Decode()
if err != nil {
println(err)
return
}
for _, sample := range dgram.Samples {
println(sample)
}
}
func sFlowListen... | package main
import (
"bytes"
"fmt"
"github.com/Cistern/sflow"
"net"
"time"
)
func sFlowParser(buffer []byte) {
reader := bytes.NewReader(buffer)
d := sflow.NewDecoder(reader)
dgram, err := d.Decode()
if err != nil {
println(err)
return
}
for _, sample := range dgram.Samples {
println(sample)
}
}
f... | Break listener operation for graceful exit | Break listener operation for graceful exit
| Go | mit | TuxPowered42/ddos_detector |
ed1300a4e45471b4504ea63d0e4cb06a44ce219a | main.go | main.go | package main
import (
"os"
"github.com/intelsdi-x/pulse/control/plugin"
"github.com/intelsdi-x/pulse/plugin/publisher/pulse-publisher-hana/hana"
)
func main() {
meta := hana.Meta()
plugin.Start(meta, hana.NewHANAPublisher(), os.Args[1])
}
| package main
import (
"os"
"github.com/intelsdi-x/pulse-plugin-publisher-hana/hana"
"github.com/intelsdi-x/pulse/control/plugin"
)
func main() {
meta := hana.Meta()
plugin.Start(meta, hana.NewHANAPublisher(), os.Args[1])
}
| Fix import path for hana package | Fix import path for hana package
| Go | apache-2.0 | intelsdi-x/snap-plugin-publisher-hana,intelsdi-x/snap-plugin-publisher-hana,intelsdi-x/snap-plugin-publisher-hana |
9dea517fbe838d0e38b132d1096436e35b014c91 | main.go | main.go | package main
import (
"github.com/thomasf/drone-mvn/mavendeploy"
"github.com/drone/drone-plugin-go/plugin"
)
func main() {
workspace := plugin.Workspace{}
repo := plugin.Repo{}
build := plugin.Build{}
vargs := mavendeploy.Maven{}
plugin.Param("repo", &repo)
plugin.Param("build", &build)
plugin.Param("worksp... | package main
import (
"flag"
"os"
"github.com/drone/drone-plugin-go/plugin"
"github.com/thomasf/drone-mvn/mavendeploy"
)
// testExpressions allows for quickly testing source/regexp patterns against
// files via the command line.
func testExpressions() {
var regexp, source string
flag.StringVar(®exp, "regexp... | Add command line option to test source/regexp | Add command line option to test source/regexp
Special case, not used when running as a drone plugin
| Go | apache-2.0 | thomasf/drone-mvn |
ea6afc7f15fa6129b078ea3e176bc352a3cc5d5d | main.go | main.go | package main
import (
"fmt"
"os"
"github.com/sosedoff/musicbot/bot"
)
func main() {
if os.Getenv("MOPIDY_HOST") == "" {
fmt.Println("MOPIDY_HOST is not provided")
return
}
if os.Getenv("SLACK_TOKEN") == "" {
fmt.Println("SLACK_TOKEN is not provided")
return
}
if os.Getenv("SLACK_CHANNEL") == "" {
... | package main
import (
"fmt"
"os"
"github.com/jessevdk/go-flags"
"github.com/sosedoff/musicbot/bot"
)
var options struct {
MopidyHost string `long:"mopidy" description:"Mopidy server host:port" env:"MOPIDY_HOST"`
SlackToken string `long:"slack-token" description:"Slack integration token" env:"SLACK_TOKEN"`
... | Implement flags via third-party package | Implement flags via third-party package
| Go | mit | sosedoff/musicbot |
824d2eb57c089487cd5a98a89aa5aade3c828c07 | main.go | main.go | package main
import (
"fmt"
_ "github.com/friendlylinuxplayers/flip.earth/config"
_ "github.com/friendlylinuxplayers/flip.earth/router"
_ "github.com/friendlylinuxplayers/flip.earth/server"
"github.com/friendlylinuxplayers/flip.earth/service"
cs "github.com/friendlylinuxplayers/flip.earth/service/config"
)
// ... | // FLiP.Earth is the website for the Friendly Linux Players community.
//
// See https://FriendlyLinuxPlayers.org for the live website and
// https://github.com/FriendlyLinuxPlayers/flip.earth for the code.
package main
import (
"fmt"
_ "github.com/friendlylinuxplayers/flip.earth/config"
_ "github.com/friendlylinu... | Add a doc comment for the whole project. | Add a doc comment for the whole project.
| Go | agpl-3.0 | FriendlyLinuxPlayers/flip.earth |
7fbf69f875779c2150c07bf2a8a5fc46ad8c1885 | main.go | main.go | package main
import (
"fmt"
"github.com/joaodias/hugito-app/handlers"
"net/http"
)
func main() {
router := handlers.NewRouter()
router.Handle("repositories get", handlers.GetRepository)
router.Handle("repository validate", handlers.ValidateRepository)
router.Handle("content list", handlers.GetContentList)
rou... | package main
import (
"fmt"
"github.com/joaodias/hugito-app/handlers"
"net/http"
"os"
)
func main() {
router := handlers.NewRouter()
router.Handle("repositories get", handlers.GetRepository)
router.Handle("repository validate", handlers.ValidateRepository)
router.Handle("content list", handlers.GetContentList... | Add support to an env port assignment | Add support to an env port assignment
Heroku randomly gives the application a port. So one should be aware of that.
Issue #46
| Go | mit | joaodias/hugito-app |
c46857ce5326753d497a90997a4c38c58f0229a3 | cmd/gp/main.go | cmd/gp/main.go | package main
import (
"flag"
"fmt"
"os"
"github.com/ecnahc515/gist-playground/gist"
"github.com/google/go-github/github"
)
var token string
func init() {
token = os.Getenv("GISTPLAYGROUND_TOKEN")
}
func main() {
flag.Parse()
args := flag.Args()
httpClient := gist.NewCachingHttpClient(token, nil, nil)
cl... | package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"github.com/ecnahc515/gist-playground/gist"
"github.com/google/go-github/github"
"github.com/gregjones/httpcache/diskcache"
)
const cacheDir = "gist_playground_cache"
var token string
func init() {
token = os.Getenv("GISTPLAYGROUND_TOKEN")
}
func New... | Use disk cache when accepting CLI params. | Use disk cache when accepting CLI params.
| Go | mit | chancez/goplayutils,ecnahc515/goplayutils,ecnahc515/goplayutils,chancez/goplayutils |
9efc87c0a399c4237c6ab28a0ea5e61fead2ba56 | src/go/brats/brats_test.go | src/go/brats/brats_test.go | package brats_test
import (
"github.com/cloudfoundry/libbuildpack/bratshelper"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Go buildpack", func() {
bratshelper.UnbuiltBuildpack("go", CopyBrats)
bratshelper.DeployingAnAppWithAnUpdatedVer... | package brats_test
import (
"github.com/cloudfoundry/libbuildpack/bratshelper"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Go buildpack", func() {
bratshelper.UnbuiltBuildpack("go", CopyBrats)
bratshelper.DeployingAnAppWithAnUpdatedVer... | Fix go version in another brats test | Fix go version in another brats test
Co-authored-by: An Yu <446e9838deaeb979640d56c46523b7c882d598cd@pivotal.io>
| Go | apache-2.0 | cloudfoundry/go-buildpack,cloudfoundry/go-buildpack,cloudfoundry/go-buildpack |
068da3ff0d0e1ac5590458d5d814b6c90a2edb55 | path/pathfinder.go | path/pathfinder.go | package path
import (
"fmt"
"github.com/aybabtme/graph"
)
type PathFinder interface {
HasPathTo(to int) bool
PathTo(to int) []int
}
type TremauxDFS struct {
g graph.Graph
from int
marked []bool
edgeTo []int
}
func BuildTremauxDFS(g graph.Graph, from int) PathFinder {
t := TremauxDFS{
g: g,
... | package path
import (
"github.com/aybabtme/graph"
)
type PathFinder interface {
HasPathTo(to int) bool
PathTo(to int) []int
}
type TremauxDFS struct {
g graph.Graph
from int
marked []bool
edgeTo []int
}
func BuildTremauxDFS(g graph.Graph, from int) PathFinder {
if from < 0 {
panic("Can't start DFS... | Remove unused import. Parameter checking. | Remove unused import. Parameter checking.
| Go | mit | aybabtme/graph,aybabtme/graph |
6582351c5e2e95caca8dabfb71c6b4bae987f5e9 | termite/workerstatus.go | termite/workerstatus.go | package termite
import (
"fmt"
"http"
)
func (me *WorkerDaemon) httpHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "<html><head><title>Termite worker</head></title>")
fmt.Fprintf(w, "<h1>Termite worker status</h1>")
fmt.Fprintf(w, "<body><pre>")
me.masterMapMutex.Lock()
defer me.masterMapMute... | package termite
import (
"fmt"
"http"
)
func (me *WorkerDaemon) httpHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "<html><head><title>Termite worker</head></title>")
fmt.Fprintf(w, "<h1>Termite worker status</h1>")
fmt.Fprintf(w, "<body>")
me.masterMapMutex.Lock()
defer me.masterMapMutex.Unl... | Drop <pre> to make long commands readable. | Drop <pre> to make long commands readable.
| Go | bsd-3-clause | hanwen/termite,hanwen/termite,hanwen/termite |
90031dd82876b3ffbc2c9e2e829af2e9b2010f21 | lxd/firewall/firewall_interface.go | lxd/firewall/firewall_interface.go | package firewall
import (
"net"
deviceConfig "github.com/lxc/lxd/lxd/device/config"
)
// Firewall represents a LXD firewall.
type Firewall interface {
String() string
Compat() (bool, error)
NetworkSetupForwardingPolicy(networkName string, ipVersion uint, allow bool) error
NetworkSetupOutboundNAT(networkName s... | package firewall
import (
"net"
deviceConfig "github.com/lxc/lxd/lxd/device/config"
drivers "github.com/lxc/lxd/lxd/firewall/drivers"
)
// Firewall represents a LXD firewall.
type Firewall interface {
String() string
Compat() (bool, error)
NetworkSetup(networkName string, opts drivers.Opts) error
NetworkClea... | Add NetworkSetup and remove feature specific network setup functions | lxd/firewall/firewall/interface: Add NetworkSetup and remove feature specific network setup functions
Signed-off-by: Thomas Parrott <6b778ce645fb0e3dde76d79eccad490955b1ae74@canonical.com>
| Go | apache-2.0 | atxwebs/lxd,lxc/lxd,atxwebs/lxd,stgraber/lxd,stgraber/lxd,lxc/lxd,hallyn/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,hallyn/lxd,stgraber/lxd,lxc/lxd,atxwebs/lxd,lxc/lxd,hallyn/lxd,atxwebs/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,stgraber/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd |
204ceec06b5f048a2ec90e24163c1c3076258c2e | streaming/main.go | streaming/main.go | /* Demonstrate a streaming REST API, where the data is "flushed" to the client ASAP.
The Curl Demo:
curl -i http://127.0.0.1:8080/stream
*/
package main
import (
"fmt"
"github.com/ant0ine/go-json-rest"
"net/http"
"time"
)
func main() {
handler := rest.ResourceHandler{
EnableRelaxedContentType: true... | /* Demonstrate a streaming REST API, where the data is "flushed" to the client ASAP.
The stream format is a Line Delimited JSON.
The Curl Demo:
curl -i http://127.0.0.1:8080/stream
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 16 Feb 2014 00:39:19 GMT
Transfer-Enc... | Make the stream format a Line Delimited JSON | Make the stream format a Line Delimited JSON
| Go | mit | jacobxk/go-json-rest-examples,ant0ine/go-json-rest-examples,snowsnail/go-json-rest-examples |
e8aef4b9bf80da660c0374c6d476c87a3233a35e | examples/crasher/main.go | examples/crasher/main.go | package main
import (
"image/color"
"time"
"github.com/voxelbrain/pixelpixel/imageutils"
"github.com/voxelbrain/pixelpixel/protocol"
)
func main() {
c := protocol.PixelPusher()
img := protocol.NewPixel()
dImg := imageutils.DimensionChanger(img, 4, 1)
for i := 0; i < 5; i++ {
if i < 3 {
dImg.Set(i, 0, c... | package main
import (
"fmt"
"image"
"time"
"github.com/voxelbrain/pixelpixel/imageutils"
"github.com/voxelbrain/pixelpixel/protocol"
)
func main() {
c := protocol.PixelPusher()
img := protocol.NewPixel()
dImg := imageutils.DimensionChanger(img, 4, 6)
for i := 0; i < 5; i++ {
color := imageutils.Green
i... | Rewrite crash with actual textual countdown | Rewrite crash with actual textual countdown
| Go | mit | voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel |
f0c9300b99921e0bc8bd015ec9b2476993fa6b2b | rules/regexp/regexp_test.go | rules/regexp/regexp_test.go | package regexp
import (
"testing"
"github.com/tonyhb/govalidate/rules"
)
func TestRegexp(t *testing.T) {
object := rules.ValidationData{
Field: "Test",
Args: []interface{}{"^[a-zA-Z]{3,5}[0-9]+$"},
}
var valid = []interface{}{
"aaaaa0",
"aaa123456789",
}
var invalid = []interface{}{
1,
'a',
"0... | package regexp
import (
"testing"
"github.com/tonyhb/govalidate/rules"
)
func TestRegexp(t *testing.T) {
object := rules.ValidationData{
Field: "Test",
Args: []string{"/^[a-zA-Z]{3,5}[0-9]+$/"},
}
var valid = []interface{}{
"aaaaa0",
"aaa123456789",
}
var invalid = []interface{}{
1,
'a',
"0aaa... | Fix separate regexp tests with changed arg type | Fix separate regexp tests with changed arg type
| Go | mit | tonyhb/govalidate |
c56620cf2f25c751aec3bb4e53d5585b01528116 | src/server/adapter/adapter.go | src/server/adapter/adapter.go | package adapter
import (
"github.com/domain-query-language/dql-server/src/server/vm/handler"
)
type Adapter interface {
Next() (Handleable, error)
}
// Make it easy to get the correct type out, no need for casting based on "HandleableType"
type Handleable interface {
Type() HandleableType
Command() handler.Com... | package adapter
import (
"github.com/domain-query-language/dql-server/src/server/vm/handler"
)
type Adapter interface {
Next() (Handleable, error)
}
// Make it easy to get the correct type out, no need for casting based on "HandleableType"
type Handleable struct {
typ HandleableType
command handler.Command
qu... | Refactor to just use a struct instead of an interface | Refactor to just use a struct instead of an interface
| Go | mit | domain-query-language/dql-server |
0620c4308eb2a10174d6e261b273927ad5b5e63c | src/todolist/todolist_test.go | src/todolist/todolist_test.go | package main
import (
"io/ioutil"
"net/http/httptest"
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func TestNonHandledEndpoint(t *testing.T) {
req := httptest.NewRequest("GET", "http://example.com/foo", nil)
w := httptest.NewRecorder()
NewRouter().ServeHTTP(w, req)
resp := w.Result()
body, ... | package main
import (
"io/ioutil"
"net/http/httptest"
"strings"
"testing"
"encoding/json"
"github.com/stretchr/testify/require"
"todolist/repo"
)
func TestNonHandledEndpoint(t *testing.T) {
req := httptest.NewRequest("GET", "http://example.com/foo", nil)
w := httptest.NewRecorder()
NewRouter().ServeHTTP(w,... | Add unit test for the /todos endpoint | Add unit test for the /todos endpoint
| Go | mit | peppelan/ToDoList,peppelan/ToDoList |
32f7ef7c1ee4cd252a382be5f1d7d990f7940192 | server/server.go | server/server.go | package server
import (
"fmt"
"html/template"
"net/http"
"net/url"
)
func RootHandler(w http.ResponseWriter, r *http.Request, processes []*Process) {
tmpl, err := template.ParseFiles("templates/root.html")
if err != nil {
fmt.Printf("Error parsing template")
}
if err := tmpl.Execute(w, processes); err != ni... | package server
import (
"fmt"
"html/template"
"net/http"
)
func RootHandler(w http.ResponseWriter, r *http.Request, processes []*Process) {
tmpl, err := template.ParseFiles("templates/root.html")
if err != nil {
fmt.Printf("Error parsing template")
}
if err := tmpl.Execute(w, processes); err != nil {
fmt.P... | Remove form submission, simply add lag | Remove form submission, simply add lag
| Go | unlicense | dgottlieb/consensus,dgottlieb/consensus |
aa250b1cbee900e4e6565dce894db6d2078db6e9 | client/hashing.go | client/hashing.go | package glock
import (
"github.com/stathat/consistent"
)
func initServersPool(endpoints []string) *consistent.Consistent {
cons := consistent.New()
for _, endpoint := range endpoints {
// TODO: First check if endpoint is live
cons.Add(endpoint)
}
return cons
}
| package glock
import (
"net"
"github.com/stathat/consistent"
)
func initServersPool(endpoints []string) *consistent.Consistent {
cons := consistent.New()
for _, endpoint := range endpoints {
conn, err := net.Dial("tcp", endpoint)
if err == nil {
cons.Add(endpoint)
conn.Close()
}
}
return cons
}
| Check endpoint status first before adding into the hash table | Check endpoint status first before adding into the hash table
| Go | mit | iron-io/glock |
14c649331b5ec886fd283adb545e84ef6db62bd3 | pkg/geoipupdate/retry/retry.go | pkg/geoipupdate/retry/retry.go | package retry
import (
"net/http"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/pkg/errors"
)
// MaybeRetryRequest is an internal implementation detail of this module. It
// shouldn't be used by users of the geoipupdate Go library. You can use the
// RetryFor field of geoipupdate.Config if you'd like to re... | package retry
import (
"net/http"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/pkg/errors"
)
// MaybeRetryRequest is an internal implementation detail of this module. It
// shouldn't be used by users of the geoipupdate Go library. You can use the
// RetryFor field of geoipupdate.Config if you'd like to re... | Raise errors on incorrect library usage | Raise errors on incorrect library usage
| Go | apache-2.0 | maxmind/geoipupdate,maxmind/geoipupdate,maxmind/geoipupdate |
31527148797c6ba4910c8a9117172adac6d7581a | kitsu/kitsu_test.go | kitsu/kitsu_test.go | package kitsu
import "testing"
func TestNewClient(t *testing.T) {
c := NewClient(nil)
if got, want := c.BaseURL.String(), defaultBaseURL; got != want {
t.Errorf("NewClient BaseURL is %v, want %v", got, want)
}
}
func TestNewRequest(t *testing.T) {
c := NewClient(nil)
inURL, outURL := "/foo", defaultBaseURL+... | package kitsu
import (
"net/url"
"testing"
)
func TestNewClient(t *testing.T) {
c := NewClient(nil)
if got, want := c.BaseURL.String(), defaultBaseURL; got != want {
t.Errorf("NewClient BaseURL is %v, want %v", got, want)
}
}
func TestClient_NewRequest(t *testing.T) {
c := NewClient(nil)
inURL, outURL := ... | Add parse error test for bad URL case | Add parse error test for bad URL case
| Go | mit | nstratos/go-kitsu |
25c57973765c63100791055e7f45cfc414d07fc8 | provider/vsphere/init_gccgo.go | provider/vsphere/init_gccgo.go | // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// +build gccgo
package vsphere
const (
providerType = "vsphere"
)
| // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// +build gccgo
// This file exists so that this package will remain importable under
// GCCGo. In particular, see provider/all/all.go. All other files in
// this package do not build under GCCGo (see lp:1440940).
package vs... | Add a comment explaining the reason for the build constraints. | Add a comment explaining the reason for the build constraints.
| Go | agpl-3.0 | tych0/juju,makyo/juju,gabriel-samfira/juju,waigani/juju,bz2/juju,mikemccracken/juju,sinzui/juju,fwereade/juju,wwitzel3/juju,cloud-green/juju,cherylj/juju,AdamIsrael/juju,thomnico/juju,ericsnowcurrently/juju,perrito666/juju,dimitern/juju,mjs/juju,marcmolla/juju,wwitzel3/juju,AdamIsrael/juju,frankban/juju,tasdomas/juju,c... |
41bed60213c81ccb550342a1efc24fc48d3587dc | go/gedcom/hidify/hidify.go | go/gedcom/hidify/hidify.go | package main
import (
"log"
"os"
"path"
)
func main() {
if len(os.Args) != 3 {
log.Fatalf("Usage: %s input-file output-file", path.Base(os.Args[0]))
}
i, err := os.Open(os.Args[1])
if err != nil {
log.Fatalf("Cannot open %q for reading", os.Args[1])
}
defer i.Close()
o, err := os.Create(os... | package main
import (
"bufio"
"io"
"log"
"os"
"path"
)
func main() {
if len(os.Args) != 3 {
log.Fatalf("Usage: %s input-file output-file", path.Base(os.Args[0]))
}
i, err := os.Open(os.Args[1])
if err != nil {
log.Fatalf("Cannot open %q for reading: %v", os.Args[1], err)
}
defer i.Close... | Add reading/writing logic (but at the moment just echo--no processing logic). | Add reading/writing logic (but at the moment just echo--no processing logic).
| Go | apache-2.0 | pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff |
1e5ebafcc4bc4f0062b9e702f3039ec2a759d9bc | internal/globalvar/version.go | internal/globalvar/version.go | // Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
// Licensed under the Mozilla Public License v2.0
package globalvar
import (
"log"
)
const Version = "4.66.0"
const ReleaseDate = "2022-03-04"
func PrintVersion() {
log.Printf("[INFO] terraform-provider-oci %s\n", Version)
}
| // Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
// Licensed under the Mozilla Public License v2.0
package globalvar
import (
"log"
)
const Version = "4.66.0"
const ReleaseDate = "2022-03-02"
func PrintVersion() {
log.Printf("[INFO] terraform-provider-oci %s\n", Version)
}
| Update release date with 2022-03-02 | Update release date with 2022-03-02
| Go | mpl-2.0 | oracle/terraform-provider-baremetal,oracle/terraform-provider-baremetal |
1ff17b7a3778c1a539072fc40dcf1f969a1be3d2 | modules/agent/g/const.go | modules/agent/g/const.go | package g
import (
"time"
)
// changelog:
// 3.1.3: code refactor
// 3.1.4: bugfix ignore configuration
// 5.0.0: 支持通过配置控制是否开启/run接口;收集udp流量数据;du某个目录的大小
// 5.1.0: 同步插件的时候不再使用checksum机制
// 5.1.3: Fix config syntax error when deploying
// 5.1.4: Only trustable ip could access the webpage
// 5.1.5: New policy and plugi... | package g
import (
"time"
)
// changelog:
// 3.1.3: code refactor
// 3.1.4: bugfix ignore configuration
// 5.0.0: 支持通过配置控制是否开启/run接口;收集udp流量数据;du某个目录的大小
// 5.1.0: 同步插件的时候不再使用checksum机制
// 5.1.3: Fix config syntax error when deploying
// 5.1.4: Only trustable ip could access the webpage
// 5.1.5: New policy and plugi... | Update cfg.json in release package. | Update cfg.json in release package.
v5.1.5 壓縮包中的 cfg.json 有誤,重新更新一版到 v5.1.6,程式檔案不變,僅更新壓縮包中的 cfg.json。 | Go | apache-2.0 | Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open... |
58a0da4ed7b321c9b5dfeffb7e03ee188fae1c60 | runewidth_windows.go | runewidth_windows.go | package runewidth
import (
"syscall"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32")
procGetACP = kernel32.NewProc("GetACP")
)
func IsEastAsian() bool {
r1, _, _ := procGetACP.Call()
if r1 == 0 {
return false
}
switch int(r1) {
case 932, 51932, 936, 949, 950:
return true
}
return false
}
| package runewidth
import (
"syscall"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32")
procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP")
)
func IsEastAsian() bool {
r1, _, _ := procGetConsoleOutputCP.Call()
if r1 == 0 {
return false
}
switch int(r1) {
case 932, 51932, 936, 949,... | Use GetConsoleCP instead of GetACP | Use GetConsoleCP instead of GetACP
| Go | mit | mattn/go-runewidth |
383e4f36649b88789333bef1ee3c447fee63ca58 | src/util/json.go | src/util/json.go | package util
import (
"encoding/json"
"io"
)
// DecodeJSON decodes json
func DecodeJSON(src io.Reader, dst interface{}) error {
decoder := json.NewDecoder(src)
err := decoder.Decode(dst)
return err
}
// EncodeJSON encodes json
func EncodeJSON(dst io.Writer, src interface{}) error {
encoder := json.NewEncoder(d... | package util
import (
"encoding/json"
"io"
)
// DecodeJSON decodes json
func DecodeJSON(src io.Reader, dst interface{}) error {
decoder := json.NewDecoder(src)
err := decoder.Decode(dst)
return err
}
// EncodeJSON encodes json
func EncodeJSON(dst io.Writer, src interface{}) error {
encoder := json.NewEncoder(d... | Add utility function for writing failure JSON msgs | Add utility function for writing failure JSON msgs
| Go | mit | NaExpire/API |
bb0249730ee9c2bcc9a66655f9181717152abd12 | src/12/problem_12.go | src/12/problem_12.go | package main
import (
"fmt"
)
func main() {
fmt.Printf("Hello world!\n")
}
| package main
import (
"fmt"
)
func main() {
for i := 1; i <= 10; i++ {
sum := SumN(i)
list := ListDivisors(sum)
fmt.Printf("%02d: %d %v\n", i, sum, list)
}
}
func SumN(n int) int {
return (n * (n + 1)) / 2
}
func ListDivisors(n int) []int {
divisors := make([]int, 0)
for i := 1; i <= n/2; i++ {
if... | Add Sum and Divisor Algorithms | Add Sum and Divisor Algorithms
| Go | mit | benjic/euler |
af680b70dd690ccad987ae533abc6197341ee20b | client/client.go | client/client.go | package client
import (
"time"
"github.com/golang/protobuf/proto"
"golang.org/x/net/context"
)
type Client interface {
Init()
Call(ctx context.Context, serviceName, endpoint string, req proto.Message, res proto.Message) error
}
var defaultTimeout time.Duration = 1 * time.Second
var DefaultClient Client = NewR... | package client
import (
"time"
"github.com/golang/protobuf/proto"
"golang.org/x/net/context"
)
type Client interface {
Init()
Call(ctx context.Context, service, endpoint string, req proto.Message, res proto.Message) error
}
var defaultTimeout time.Duration = 1 * time.Second
var DefaultClient Client = NewRabbi... | Tidy up serviceName variable naming | Tidy up serviceName variable naming
| Go | mit | mondough/typhon,monzo/typhon |
9d060bf6e1e43b2ea8c387091ae62909b39cb602 | client/mock/mock_test.go | client/mock/mock_test.go | package mock
import (
"testing"
"github.com/micro/go-micro/errors"
"golang.org/x/net/context"
)
func TestClient(t *testing.T) {
response := []MockResponse{
{Method: "Foo.Bar", Response: map[string]interface{}{"foo": "bar"}},
{Method: "Foo.Fail", Error: errors.InternalServerError("go.mock", "failed")},
}
... | package mock
import (
"testing"
"github.com/micro/go-micro/errors"
"golang.org/x/net/context"
)
func TestClient(t *testing.T) {
type TestRequest struct {
Param string
}
response := []MockResponse{
{Method: "Foo.Bar", Response: map[string]interface{}{"foo": "bar"}},
{Method: "Foo.Struct", Response: &Tes... | Test struct works with mock client | Test struct works with mock client
| Go | apache-2.0 | divisionone/go-micro,uffy/go-micro,Taik/go-micro,myodc/go-micro,micro/go-micro |
d4b7f0178c704f63fa66353a058b9b1a7eab31b8 | crc32_generic.go | crc32_generic.go | // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build 386 arm arm64 ppc64 ppc64le appengine
package crc32
// The file contains the generic version of updateCastagnoli which does
// slicing-by-8, or uses... | // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build 386 arm arm64 ppc64 ppc64le appengine gccgo
package crc32
// The file contains the generic version of updateCastagnoli which does
// slicing-by-8, o... | Add gccgo to generic build | Add gccgo to generic build
| Go | bsd-3-clause | yxd-hde/crc32,klauspost/crc32 |
f440bf2f56ea93ed679574086dc7b7960b12b203 | tenets/codelingo/go/assignment-to-nil-map/main.go | tenets/codelingo/go/assignment-to-nil-map/main.go | package main
import "time"
func main() {
now := time.Now().Unix()
metrics := []string{"example"}
var accessTimes map[string]int64
// accessTimes = make(map[string]int64)
for _, m := range metrics {
accessTimes[m] = now
}
}
| package main
import "time"
func main() {
now := time.Now().Unix()
metrics := []string{"example"}
var accessTimes map[string]int64 // ISSUE
for _, m := range metrics {
accessTimes[m] = now
}
}
| Add comment to example file | Add comment to example file
| Go | agpl-3.0 | lingo-reviews/lingo,lingo-reviews/lingo |
404b358ff3cfe91a9b84e8071d0a6ebdf512dbf9 | testing/constants.go | testing/constants.go | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testing
import (
"time"
"launchpad.net/juju-core/utils"
)
// ShortWait is a reasonable amount of time to block waiting for something that
// shouldn't actually happen. (as in, the test suite will *actually* ... | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testing
import (
"time"
"launchpad.net/juju-core/utils"
)
// ShortWait is a reasonable amount of time to block waiting for something that
// shouldn't actually happen. (as in, the test suite will *actually* ... | Update tests to support "utopic" | [r=wallyworld],[bug=1311955] Update tests to support "utopic"
Add "utopic" to SupportedSeries const
in testing package.
https://codereview.appspot.com/94730043/ | Go | agpl-3.0 | thomnico/juju,Altoros/juju-cloudsigma,marcmolla/juju,tych0/juju,mjs/juju,anastasiamac/juju,anastasiamac/juju,marcoceppi/juju,cherylj/juju,fwereade/juju,makyo/juju,bogdanteleaga/juju,sinzui/juju,thomnico/juju,frobware/juju,bz2/juju,howbazaar/juju,cherylj/juju,ericsnowcurrently/juju,davecheney/juju,dimitern/juju,marcocep... |
210db1234dfb8d279bc1e5e2c8438dc8db2ee27d | daemon/execdriver/lxc/lxc_init_unsupported.go | daemon/execdriver/lxc/lxc_init_unsupported.go | // +build !linux
package lxc
import "github.com/docker/docker/daemon/execdriver"
func setHostname(hostname string) error {
panic("Not supported on darwin")
}
func finalizeNamespace(args *execdriver.InitArgs) error {
panic("Not supported on darwin")
}
| // +build !linux
package lxc
func setHostname(hostname string) error {
panic("Not supported on darwin")
}
func finalizeNamespace(args *InitArgs) error {
panic("Not supported on darwin")
}
| Fix lxc driver build issue on Mac OS X | Fix lxc driver build issue on Mac OS X
Docker-DCO-1.1-Signed-off-by: Albert Zhang <zhgwenming@gmail.com> (github: zhgwenming)
| Go | apache-2.0 | 14rcole/docker,flavio/docker,mikebrow/docker,cyphar/docker,mountkin/docker,xnox/docker,Neverous/docker,ashmo123/docker,solganik/docker,haveatry/docker,mgoelzer/docker,tkopczynski/docker,cnbin/docker,Lanzafame/docker,tklauser/docker,containers/storage,boucher/docker,vdemeester/docker,inversion/docker,majst01/docker,cmeh... |
9a658e04ab95ff0bcb0c708526bd55361fd7309a | cf/delete_stack.go | cf/delete_stack.go | package cf
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/urfave/cli"
)
func deleteStack(ctx *cli.Context) error {
name := ctx.Args().First()
if name == "" {
cli.ShowSubcommandHelp(ctx)
return nil
}
_, err := cfClient.DeleteStack(&cloudforma... | package cf
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/sam701/awstools/sess"
"github.com/urfave/cli"
)
func deleteStack(ctx *cli.Context) error {
name := ctx.Args().First()
if name == "" {
cli.ShowSubcommandHelp(ctx)
return nil
}
cfClien... | Fix invalid memory address by CF delete operation | Fix invalid memory address by CF delete operation
Fixes #22
| Go | mit | sam701/awstools |
e3ce7664494fd333eb271bccfa3f8ada9134ad8a | apis/federation/v1beta1/doc.go | apis/federation/v1beta1/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 file tags to generate conversions | Use file tags to generate conversions
This drives conversion generation from file tags like:
// +conversion-gen=k8s.io/my/internal/version
.. rather than hardcoded lists of packages.
The only net change in generated code can be explained as correct. Previously
it didn't know that conversion was available.
| Go | apache-2.0 | kubernetes-retired/cluster-registry,kubernetes-retired/cluster-registry |
82ead6bcf1ec5b072370f4ebf2d586a5ec511908 | service/upload/upload.go | service/upload/upload.go | package uploadService
import (
"strings"
)
func CheckTrackers(trackers []string) bool {
// TODO: move to runtime configuration
var deadTrackers = []string{ // substring matches!
"://open.nyaatorrents.info:6544",
"://tracker.openbittorrent.com:80",
"://tracker.publicbt.com:80",
"://stats.anisource.net:2710"... | package uploadService
import (
"strings"
)
func CheckTrackers(trackers []string) bool {
// TODO: move to runtime configuration
var deadTrackers = []string{ // substring matches!
"://open.nyaatorrents.info:6544",
"://tracker.openbittorrent.com:80",
"://tracker.publicbt.com:80",
"://stats.anisource.net:2710"... | Update list of dead trackers | Update list of dead trackers
| Go | mit | sisimouto/nyaa,sisimouto/nyaa,sisimouto/nyaa,sisimouto/nyaa |
0f2616689a35ef0ddf917fe26f60df187dbcc5b7 | middlewares/metrics_middleware.go | middlewares/metrics_middleware.go | package middlewares
import (
"fmt"
"io"
"net/http"
"github.com/urfave/negroni"
"os"
"time"
"github.com/pkg/errors"
)
type MetricsMiddleware struct {
writer io.Writer
}
func NewMetricsMiddlewareFromFilename(filename string) *MetricsMiddleware {
fileWriter, e := os.OpenFile(filename, os.O_CREATE|os.O_APPEN... | package middlewares
import (
"fmt"
"io"
"net/http"
"sync"
"github.com/urfave/negroni"
"os"
"time"
"github.com/pkg/errors"
)
type MetricsMiddleware struct {
writer io.Writer
writerMutex sync.Mutex
}
func NewMetricsMiddlewareFromFilename(filename string) *MetricsMiddleware {
fileWriter, e := os.Open... | Use mutex to avoid concurrent write to metrics log file | Use mutex to avoid concurrent write to metrics log file
| Go | apache-2.0 | cloudfoundry-incubator/bits-service,cloudfoundry-incubator/bits-service,petergtz/bitsgo,cloudfoundry-incubator/bits-service,cloudfoundry-incubator/bits-service,petergtz/bitsgo,cloudfoundry-incubator/bits-service |
9ab7894481f59cbb9e4716def60c3e0a8ae38524 | jsify_test.go | jsify_test.go | package jsify
import (
"testing"
)
func Test_Example(t *testing.T) {
structs := make([]interface{}, 3)
structs[0] = &Foo{}
structs[1] = &Bar{}
structs[2] = &Baz{}
_, err := GenerateJavascriptToString(structs)
if err != nil {
t.Fail()
}
}
| package jsify
import (
"os"
"testing"
)
func Test_NoErrors(t *testing.T) {
structs := make([]interface{}, 3)
structs[0] = &Foo{}
structs[1] = &Bar{}
structs[2] = &Baz{}
_, err := GenerateJavascriptToString(structs)
if err != nil {
t.Fail()
}
}
func Test_MakeFile(t *testing.T) {
fileName := "./structs.js"... | Add simple test for file generation. | Add simple test for file generation.
| Go | apache-2.0 | mattbaird/GoJSObjectGenerator |
96542b7157e847a9ad9b771ecf4bd5af65639412 | gondole.go | gondole.go | package gondole
import ()
import (
"github.com/sendgrid/rest"
"fmt"
)
const (
APIVersion = "0.0"
APIEndpoint = "/api/v1"
NoRedirect = "urn:ietf:wg:oauth:2.0:oob"
)
// prepareRequest insert all pre-defined stuff
func (g *Gondole) prepareRequest(what string) (req rest.Request) {
endPoint := APIEndpoint + fmt.S... | package gondole
import ()
import (
"github.com/sendgrid/rest"
"fmt"
)
const (
APIVersion = "0.0"
APIEndpoint = "/api/v1"
NoRedirect = "urn:ietf:wg:oauth:2.0:oob"
)
// prepareRequest insert all pre-defined stuff
func (g *Gondole) prepareRequest(what string) (req rest.Request) {
endPoint := APIEndpoint + fmt.S... | Add a tailored version of prepareRequest(). | Add a tailored version of prepareRequest().
| Go | mit | keltia/gondole |
989a803a5ba2ea787d3178fd918671e11a5a1871 | arch.go | arch.go | // +build !windows
package gottyclient
import (
"encoding/json"
"fmt"
"os"
"os/signal"
"syscall"
"unsafe"
)
func notifySignalSIGWINCH(c chan<- os.Signal) {
signal.Notify(c, syscall.SIGWINCH)
}
func resetSignalSIGWINCH() {
signal.Reset(syscall.SIGWINCH)
}
func syscallTIOCGWINSZ() ([]byte, error) {
ws := wi... | // +build !windows
package gottyclient
import (
"encoding/json"
"fmt"
"golang.org/x/sys/unix"
"os"
"os/signal"
"syscall"
)
func notifySignalSIGWINCH(c chan<- os.Signal) {
signal.Notify(c, syscall.SIGWINCH)
}
func resetSignalSIGWINCH() {
signal.Reset(syscall.SIGWINCH)
}
func syscallTIOCGWINSZ() ([]byte, err... | Replace SYS_IOCTL by cross platform version | Replace SYS_IOCTL by cross platform version
| Go | mit | moul/gotty-client,moul/gotty-client,moul/gotty-client,moul/gotty-client |
9f8cfd7480b6adea5c945b4ef15d2b9caf23c542 | formatter_test.go | formatter_test.go | // Copyright 2013 Marc Weistroff. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package log
import (
"testing"
"time"
)
func TestMinimalLineFormatter(t *testing.T) {
r := newRecord(DEBUG, "foobar", "msg", map[string]string{"foo": "bar"})
fo... | // Copyright 2013 Marc Weistroff. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package log
import (
"testing"
"time"
)
func TestMinimalLineFormatter(t *testing.T) {
r := newRecord(DEBUG, "foobar", "msg", map[string]string{"foo": "bar"})
fo... | Update test to take account that newlines can occur in message | Update test to take account that newlines can occur in message
| Go | mit | marcw/log |
47f3a348fa3f15954819f329681beefe9d70d87c | chain_func_test.go | chain_func_test.go | package chain
import "testing"
func TestFuncEnd(t *testing.T) {
c := New(nestedHandler0, nestedHandler0)
c = c.Append(nestedHandler1, nestedHandler1)
mc := New(nestedHandler0, nestedHandler0)
c = c.Merge(mc)
h := c.EndFn(endHandler)
w, err := record(h)
if err != nil {
t.Fatalf("unexpected error: %s\n", er... | package chain
import "testing"
func TestFuncHandlerOrder(t *testing.T) {
c := New(nestedHandler0, nestedHandler0)
c = c.Append(nestedHandler1, nestedHandler1)
mc := New(nestedHandler0, nestedHandler0)
c = c.Merge(mc)
h := c.EndFn(endHandler)
w, err := record(h)
if err != nil {
t.Fatalf("unexpected error: ... | Rename functional test with specificity. | Rename functional test with specificity.
| Go | mit | codemodus/chain |
012e96970b99a348a3fc5a310b5a7447f8ef8773 | main.go | main.go | // Package linear provides a linear-algebra toolbox.
package linear
// Tensor computes the tensor product of a number of vectors.
func Tensor(data ...[]float64) []float64 {
nd := len(data)
dims := make([]int, nd)
for i := 0; i < nd; i++ {
dims[i] = len(data[i])
}
aprod := make([]int, nd)
aprod[0] = 1
for i ... | // Package linear provides a linear-algebra toolbox.
package linear
// Tensor computes the tensor product of a number of vectors.
func Tensor(vectors ...[]float64) []float64 {
nd := len(vectors)
dims := make([]int, nd)
for i := 0; i < nd; i++ {
dims[i] = len(vectors[i])
}
aprod := make([]int, nd)
aprod[0] = ... | Rename the argument of Tensor | Rename the argument of Tensor
| Go | mit | ready-steady/linear |
b9dcb9f8da6477719f0b9b825f3ffa66b9a7e1bf | pkg/sdn/plugin/pod_unsupported.go | pkg/sdn/plugin/pod_unsupported.go | // +build !linux
package plugin
import (
"fmt"
cnitypes "github.com/containernetworking/cni/pkg/types"
"github.com/openshift/origin/pkg/sdn/plugin/cniserver"
)
func (m *podManager) setup(req *cniserver.PodRequest) (*cnitypes.Result, *runningPod, error) {
return nil, nil, fmt.Errorf("openshift-sdn is unsupporte... | // +build !linux
package plugin
import (
"fmt"
cnitypes "github.com/containernetworking/cni/pkg/types"
"github.com/openshift/origin/pkg/sdn/plugin/cniserver"
)
func (m *podManager) setup(req *cniserver.PodRequest) (*cnitypes.Result, *runningPod, error) {
return nil, nil, fmt.Errorf("openshift-sdn is unsupporte... | Fix stub interface so Mac compilations work | Fix stub interface so Mac compilations work
The stub "unsupported" interface had the wrong signature. This
corrects it to prevent a compilation error on Macs.
Fixes bug 1417747 https://bugzilla.redhat.com/show_bug.cgi?id=1417747
| Go | apache-2.0 | legionus/origin,liangxia/origin,childsb/origin,detiber/origin,rrati/origin,juanvallejo/origin,php-coder/origin,spadgett/origin,xiuwang/origin,JacobTanenbaum/origin,tdawson/origin,miminar/origin,dinhxuanvu/origin,mrogers950/origin,dcbw/origin,PI-Victor/origin,ramr/origin,liggitt/origin,rhcarvalho/origin,dcbw/origin,mdsh... |
ace2231bcd7cf0979a21960b1c391023e33bef93 | examples/add-action/main.go | examples/add-action/main.go | package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
openwhisk "github.com/c3sr/openwhisk-go"
actions "github.com/c3sr/openwhisk-go/client/actions"
models "github.com/c3sr/openwhisk-go/models"
)
func main() {
cli, err := openwhisk.NewBasicAuthClientFromEnv()
if err != nil {
log.Fatal(err)
}
p := ... | package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
openwhisk "github.com/c3sr/openwhisk-go"
actions "github.com/c3sr/openwhisk-go/client/actions"
models "github.com/c3sr/openwhisk-go/models"
)
func main() {
cli, err := openwhisk.NewBasicAuthClientFromEnv()
if err != nil {
log.Fatal(err)
}
p := ... | Add overwrite to update action example | Add overwrite to update action example
| Go | apache-2.0 | c3sr/openwhisk-go,c3sr/openwhisk-go |
7e5b72c2b0f7a1fdddbf05351fc3c421c5779052 | 2021/go-rest-servers/swagger/oapi-server/internal/task/taskserver.go | 2021/go-rest-servers/swagger/oapi-server/internal/task/taskserver.go | package task
type TaskServer struct {
}
| package task
import (
"net/http"
"example.com/internal/taskstore"
"github.com/labstack/echo/v4"
)
type TaskServer struct {
store *taskstore.TaskStore
}
func NewTaskServer() *TaskServer {
store := taskstore.New()
return &TaskServer{store: store}
}
func (ts *TaskServer) GetDueYearMonthDay(ctx echo.Context, yea... | Add implementation for PostTask and GetTaskId, untested | Add implementation for PostTask and GetTaskId, untested
| Go | unlicense | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog |
c2ae2a3f304615a8e193cbe099eebb286fa5d773 | message.go | message.go | package messenger
import "time"
type Message struct {
Sender Sender `json:"-"`
Recipient Recipient `json:"-"`
Time time.Time `json:"-"`
Mid string `json:"mid"`
Text string `json:"text"`
Seq int `json:"seq"`
Attachments []Attachment `json:"at... | package messenger
import "time"
// Message represents a Facebook messenge message.
type Message struct {
// Sender is who the message was sent from.
Sender Sender `json:"-"`
// Recipient is who the message was sent to.
Recipient Recipient `json:"-"`
// Time is when the message was sent.
Time time.Time `json:"-"... | Add documentation to Message and Delivery | Add documentation to Message and Delivery
| Go | mit | paked/messenger |
1a8399329024dd009a32ab91a94fb7f03bb98423 | cmd/unpacker-tool/addDevice.go | cmd/unpacker-tool/addDevice.go | package main
import (
"errors"
"fmt"
"github.com/Symantec/Dominator/lib/srpc"
"io"
"os"
"os/exec"
)
func addDeviceSubcommand(client *srpc.Client, args []string) {
if err := addDevice(client, args[0], args[1], args[2:]); err != nil {
fmt.Fprintf(os.Stderr, "Error adding device: %s\n", err)
os.Exit(1)
}
os... | package main
import (
"fmt"
uclient "github.com/Symantec/Dominator/imageunpacker/client"
"github.com/Symantec/Dominator/lib/srpc"
"io"
"os"
"os/exec"
)
func addDeviceSubcommand(client *srpc.Client, args []string) {
if err := addDevice(client, args[0], args[1], args[2:]); err != nil {
fmt.Fprintf(os.Stderr, "... | Use new imageunpacker/client.AddDevice() function in unpacker-tool. | Use new imageunpacker/client.AddDevice() function in unpacker-tool.
| Go | apache-2.0 | rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator |
cd87763200fa1c0c10c3ec18cdc24b6e7ef9d119 | rebuild.go | rebuild.go | package main
import (
"github.com/nlf/dlite/utils"
)
type RebuildCommand struct {
Disk int `short:"d" long:"disk" description:"size of disk to create" default:"30"`
SSHKey string `short:"s" long:"ssh-key" description:"path to public ssh key" default:"$HOME/.ssh/id_rsa.pub"`
}
func (c *RebuildCommand) Execute... | package main
import (
"github.com/nlf/dlite/utils"
)
type RebuildCommand struct {
Disk int `short:"d" long:"disk" description:"size of disk in GiB to create" default:"30"`
SSHKey string `short:"s" long:"ssh-key" description:"path to public ssh key" default:"$HOME/.ssh/id_rsa.pub"`
}
func (c *RebuildCommand) ... | Use GiB as default disk size unit | Use GiB as default disk size unit
This is already done in `install.go` but not here.
| Go | mit | nlf/dlite,cmosetick/dlite |
14257bdde848db45c539c516120e18306006aa97 | cmd/control/util.go | cmd/control/util.go | package control
import (
"fmt"
"strings"
"github.com/rancher/os/log"
)
func yes(question string) bool {
fmt.Printf("%s [y/N]: ", question)
var line string
_, err := fmt.Scan(&line)
if err != nil {
log.Fatal(err)
}
return strings.ToLower(line[0:1]) == "y"
}
| package control
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/rancher/os/log"
)
func yes(question string) bool {
fmt.Printf("%s [y/N]: ", question)
in := bufio.NewReader(os.Stdin)
line, err := in.ReadString('\n')
if err != nil {
log.Fatal(err)
}
return strings.ToLower(line[0:1]) == "y"
}
| Use of bufio instead of fmt.Scan for yes function | Use of bufio instead of fmt.Scan for yes function
| Go | apache-2.0 | SvenDowideit/os,juliengk/os,rancher/os,rancherio/os,rancherio/os,ibuildthecloud/os,rancher/os,ibuildthecloud/os,SvenDowideit/os,juliengk/os,gizmotronic/os,gizmotronic/os,rancherio/os |
acabbb2f38954e259c8e73b10f0fe8e7c7e6601f | core/datatypes.go | core/datatypes.go | package core
type ModelId uint16
// These data types are defined in the SunSpec Information Model Specification.
// http://sunspec.org/wp-content/uploads/2015/06/SunSpec-Information-Models-12041.pdf
// In Version 1.8 of the document, the data type definitions can be found on
// page 13.
type Acc16 uint16
type Enum16... | package core
type ModelId uint16
// These data types are defined in the SunSpec Information Model Specification.
// http://sunspec.org/wp-content/uploads/2015/06/SunSpec-Information-Models-12041.pdf
// In Version 1.8 of the document, the data type definitions can be found on
// page 13.
type Acc16 uint16
type Enum16... | Add two additional types found in the SMDX models. | Add two additional types found in the SMDX models.
Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@wildducktheories.com>
| Go | bsd-3-clause | eightyeight/gosunspec,crabmusket/gosunspec,jonseymour/gosunspec |
4fdabcf3f77e6ebbc1d6aa64f4b65549818c0b22 | sockets/tcp_socket.go | sockets/tcp_socket.go | // Package sockets provides helper functions to create and configure Unix or TCP sockets.
package sockets
import (
"crypto/tls"
"net"
)
// NewTCPSocket creates a TCP socket listener with the specified address and
// and the specified tls configuration. If TLSConfig is set, will encapsulate the
// TCP listener insid... | // Package sockets provides helper functions to create and configure Unix or TCP sockets.
package sockets
import (
"crypto/tls"
"net"
)
// NewTCPSocket creates a TCP socket listener with the specified address and
// the specified tls configuration. If TLSConfig is set, will encapsulate the
// TCP listener inside a ... | Remove duplicate "and" in GoDoc | Remove duplicate "and" in GoDoc
Signed-off-by: Sebastiaan van Stijn <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@gone.nl>
| Go | apache-2.0 | docker/go-connections |
2ade831e1630800dcd271ee654026219bddba4c8 | testdata/blank-import-lib.go | testdata/blank-import-lib.go | // Test that blank imports in library packages are flagged.
// Package foo ...
package foo
// The instructions need to go before the imports below so they will not be
// mistaken for documentation.
/* MATCH /blank import/ */ import _ "encoding/json"
import (
"fmt"
/* MATCH /blank import/ */ _ "os"
/* MATCH /bla... | // Test that blank imports in library packages are flagged.
// Package foo ...
package foo
// The instructions need to go before the imports below so they will not be
// mistaken for documentation.
/* MATCH /blank import/ */ import _ "encoding/json"
import (
"fmt"
/* MATCH /blank import/ */ _ "os"
/* MATCH /bl... | Add a blank line in a test so that gofmt won't break the magic comment's location. | Add a blank line in a test so that gofmt won't break the magic comment's location.
| Go | bsd-3-clause | lutzky/lint,tmc/lint,golang/lint,zimmski/lint,elgris/hint,kovetskiy/lint,darkliquid/lintci,gorcz/lint,hellosuper/gohint,JekaMas/hint,NichoZhang/lint |
bcaded91d17f9ac4a1b485e8f9b1561f33dfa31a | assets/etag_test.go | assets/etag_test.go | package assets
import (
"testing"
"time"
. "github.com/smartystreets/goconvey/convey"
)
func TestMain(t *testing.T) {
Convey("ETags generated on startup", t, func() {
So(etags, ShouldHaveLength, len(_bindata))
tag, err := GetAssetETag("path/doesnt/exist")
So(tag, ShouldBeEmpty)
So(err, ShouldEqual, ErrE... | package assets
import (
"os"
"testing"
"time"
. "github.com/smartystreets/goconvey/convey"
)
type testBindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi testBindataFileInfo) Name() string {
return fi.name
}
func (fi testBindataFileInfo) Size() int64 {
re... | Fix assets test for debug version generated files | Fix assets test for debug version generated files
| Go | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence |
ae333fec8d617fdd27a32f7a2ba1efecf5ea076d | util.go | util.go | package main
import (
"io"
"net"
)
func chkfatal(err error) {
if err != nil {
panic(err)
}
}
func copyClose(a, b net.Conn) {
done := make(chan struct{})
oneWay := func(dst, src net.Conn) {
io.Copy(dst, src)
dst.Close()
}
go oneWay(a, b)
go oneWay(b, a)
<-done
<-done
}
| package main
import (
"io"
"net"
)
func chkfatal(err error) {
if err != nil {
panic(err)
}
}
func copyClose(a, b net.Conn) {
done := make(chan struct{})
oneWay := func(dst, src net.Conn) {
io.Copy(dst, src)
dst.Close()
done <- struct{}{}
}
go oneWay(a, b)
go oneWay(b, a)
<-done
<-done
}
| Add missing send in copyClose() | Add missing send in copyClose()
...This would have caused it to never return.
| Go | apache-2.0 | zenhack/sandstorm-znc,zenhack/sandstorm-znc,zenhack/sandstorm-znc,zenhack/sandstorm-znc,zenhack/sandstorm-znc |
0574f5899feac372b447b8218beffe7c91f55ed1 | examples/tools.go | examples/tools.go | // +build tools
package hotstuff
import (
_ "github.com/relab/gorums"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)
| // +build tools
package examples
import (
_ "github.com/relab/gorums"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)
| Fix package name in examples | Fix package name in examples
| Go | mit | relab/gorums,relab/gorums,relab/gorums |
fc6099aaf53fc3bc43b1d7af8d2a26451de0f1be | internal/types/types_test.go | internal/types/types_test.go | package types
| package types
import (
"testing"
)
func TestShapeRetainsRowsAndColumns(t *testing.T) {
rows, columns := 2, 1
s := NewShape(rows, columns)
if s.Rows() == rows && s.Columns() == columns {
return
}
t.Fatal("Shape should retains the rows and columns equivalent to the given ones.")
}
func TestIndexRetainsRowAn... | Write test cases for "Shape" and "Index". | Write test cases for "Shape" and "Index".
| Go | mit | mitsuse/matrix-go |
b8cbbf7ec1498d39a4da89b2c3ae40fdc4ed1467 | proto_dump/proto_dump.go | proto_dump/proto_dump.go | package main
import (
"code.google.com/p/goprotobuf/proto"
"flag"
"fmt"
"github.com/rootsdev/fsbff/fs_data"
"io/ioutil"
"log"
"os"
)
func check(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
var numRecords = flag.Int("n", 10, "number of records to dump")
flag.Parse()
file, err := os.Op... | package main
import (
"code.google.com/p/goprotobuf/proto"
"flag"
"fmt"
"github.com/rootsdev/fsbff/fs_data"
"io/ioutil"
"log"
"os"
)
func check(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
var numRecords = flag.Int("n", 10, "number of records to dump")
var field = flag.String("f", "", "... | Add flag for dumping a specific field. | Add flag for dumping a specific field.
Only ID field is supported right now. Others can be added very easily.
| Go | mit | rootsdev/fsbff |
757f06b2bce261d570a501bb41452495a0525150 | make/make_files.go | make/make_files.go | package make
import (
"fmt"
log "github.com/Sirupsen/logrus"
"os"
"strings"
"time"
)
// InstallFileSystem installs a basic private file system for any given input.
func (Site *Site) InstallFileSystem(DirectoryPath string) {
// Test the file system, create it if it doesn't exist!
dirPath := fmt.Sprintf(strings.... | package make
import (
"fmt"
log "github.com/Sirupsen/logrus"
"os"
"strings"
"time"
)
// InstallFileSystem installs a basic private file system for any given input.
func (Site *Site) InstallFileSystem(DirectoryPath string) {
// Test the file system, create it if it doesn't exist!
dirPath := fmt.Sprintf(strings.... | Change path to install file systems - should not be created inside non-existant folder. | Change path to install file systems - should not be created inside non-existant folder.
| Go | mit | fubarhouse/golang-drush |
15d394c97784a74f9d6ab8cff883bfd2aea253dc | instagram-scraper/Instagram.go | instagram-scraper/Instagram.go | package instagram_scraper
import (
"net/http"
"io/ioutil"
"fmt"
"encoding/json"
"log"
)
func GetAccoutByUsername(username string) (account Account) {
url := fmt.Sprintf(ACCOUNT_JSON_INFO, username)
info := _GetJsonFromUrl(url)
account = GetFromAccountPage(info)
return account
}
func GetMedyaByUrl(url string... | package instagram_scraper
import (
"net/http"
"io/ioutil"
"fmt"
"encoding/json"
"log"
)
func GetAccoutByUsername(username string) (account Account) {
url := fmt.Sprintf(ACCOUNT_JSON_INFO, username)
info, err := _GetJsonFromUrl(url)
if err != nil {
log.Fatal(err)
}
account = GetFromAccountPage(info)
retur... | Change error handling for json function | Change error handling for json function
| Go | apache-2.0 | SolidlSnake/instagram-go-scraper |
5c8b671d9c7cb259e2a140c6f78d956a3700370d | ptypes/swapbits.go | ptypes/swapbits.go | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package ptypes
// SwapBits swaps the bits of x at indices i and j, and returns the result.
func SwapBits(x uint64, i, j uint64) uint64 {
if (x >> i & 1... | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package ptypes
// SwapBits swaps the bits of x at indices i and j, and returns the result.
// The time and space complexity is O(1), independent of word... | Add time/space complexity analysis to ptypes.SwapBits function | Add time/space complexity analysis to ptypes.SwapBits function
| Go | mit | mrekucci/epi,mrekucci/epi |
0dd9084f03352e64ba509ee7a49bee2487e36122 | memory.go | memory.go | package z80
type MemoryAccessor interface {
ReadByte(address uint16) byte
ReadByteInternal(address uint16) byte
WriteByte(address uint16, value byte)
WriteByteInternal(address uint16, value byte)
ContendRead(address uint16, time uint)
ContendReadNoMreq(address uint16, time uint)
ContendReadNoMreq_loop(address... | package z80
// MemoryAccessor is an interface to access memory addressed by the
// Z80.
// It defines four read/write method for accessing memory, taking
// into account contention when needed. In systems where memory
// contention is not an issue ReadByte and WriteByte should simply
// call ReadByteInternal and Writ... | Improve documentation of MemoryAccessor interface | Improve documentation of MemoryAccessor interface
| Go | mit | remogatto/z80,remogatto/z80,remogatto/z80 |
b69f32e9714b393f51e6a5a76da70dbc81d6dde0 | imageserver/rpcd/addImage.go | imageserver/rpcd/addImage.go | package rpcd
import (
"errors"
"fmt"
"github.com/Symantec/Dominator/proto/imageserver"
)
func (t *rpcType) AddImage(request imageserver.AddImageRequest,
reply *imageserver.AddImageResponse) error {
if imageDataBase.CheckImage(request.ImageName) {
return errors.New("image already exists")
}
// Verify all obje... | package rpcd
import (
"errors"
"fmt"
"github.com/Symantec/Dominator/proto/imageserver"
)
func (t *rpcType) AddImage(request imageserver.AddImageRequest,
reply *imageserver.AddImageResponse) error {
if imageDataBase.CheckImage(request.ImageName) {
return errors.New("image already exists")
}
// Verify all obje... | Change comment about debugging output. | Change comment about debugging output.
| Go | apache-2.0 | keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator |
0f62f21527b9014653de07fa366fb5b0f48fb16c | pkg/shim/runtimeoptions/runtimeoptions.go | pkg/shim/runtimeoptions/runtimeoptions.go | // Copyright 2018 The containerd Authors.
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//... | // Copyright 2018 The containerd Authors.
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//... | Support runtime options type used in containerd v1.5 | Support runtime options type used in containerd v1.5
| Go | apache-2.0 | google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor |
a904307036f268f42bedf98cd2cc693942862b95 | config/storage/s3_test.go | config/storage/s3_test.go | package storage
import (
"testing"
"os"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/stretchr/testify/assert"
)
func TestAWSCredentialsFromConfig(t *testing.T) {
chain := []*CredentialsProviderConfig{
{
Provider: EnvProviderName,
},
}
value := credentials.Value{
AccessKeyID: "access-... | package storage
import (
"testing"
"os"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/stretchr/testify/assert"
)
func TestDefaultS3Config(t *testing.T) {
assertStorageConfigSerialisation(t, DefaultS3Config())
}
| Remove redundant test that may leak keys | Remove redundant test that may leak keys
| Go | apache-2.0 | monax/hoard,monax/hoard,monax/hoard,monax/hoard |
b82a241e409524ca3e2d313f22f1a4fa4e5735f4 | s3proxy/handler.go | s3proxy/handler.go | package s3proxy
import (
"io"
"net/http"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/aws"
)
type S3BucketServer struct {
Bucket string
sss *s3.S3
}
func NewS3BucketServer(bucketName string, region string) *S3BucketServer {
return &S3BucketServer{
Bucket: bucketName,
sss: s3.New(aws.N... | package s3proxy
import (
"io"
"net/http"
"fmt"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
)
type S3BucketServer struct {
Bucket string
sss *s3.S3
}
func NewS3BucketServer(bucketName string, region string) *S3BucketServer {
return &S3BucketSe... | Add proper 404 error handling | Add proper 404 error handling
| Go | mit | mcoffin/s3proxy |
e16b9686bf17663885d527d592ed44a9e63ea95f | pkg/api/validation/events.go | pkg/api/validation/events.go | /*
Copyright 2014 The Kubernetes 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 law or ag... | /*
Copyright 2014 The Kubernetes 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 law or ag... | Replace "minion" with "node" in bunch of places. | Replace "minion" with "node" in bunch of places.
Kubernetes-commit: 53ae56f2052160e7b790f87b62206db1eb092d2f
| Go | apache-2.0 | kubernetes/api |
65789d9920bab84d335d9706f6b9be5ce86ef02d | json/jsonFixtures_test.go | json/jsonFixtures_test.go | package json
import (
"github.com/polydawn/refmt/tok/fixtures"
)
type situation byte
const (
situationEncoding situation = 0x1
situationDecoding situation = 0x2
)
var jsonFixtures = []struct {
title string
sequence fixtures.Sequence
serial string
only situation
}{
// Strings
{"",
fixtures.Sequen... | package json
import (
"github.com/polydawn/refmt/tok/fixtures"
)
type situation byte
const (
situationEncoding situation = 0x1
situationDecoding situation = 0x2
)
var jsonFixtures = []struct {
title string
sequence fixtures.Sequence
serial string
only situation
}{
// Strings
{"",
fixtures.Sequen... | Test json decoder munching extraneous whitespace correctly. | Test json decoder munching extraneous whitespace correctly.
Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us>
| Go | mit | polydawn/go-xlate,polydawn/refmt,polydawn/go-xlate,polydawn/refmt |
39ae739fb8cbc388701168b0fbb24572929e9e6a | agent/heartbeat.go | agent/heartbeat.go | package agent
import (
boshvitals "github.com/cloudfoundry/bosh-agent/platform/vitals"
)
type Heartbeat struct {
Deployment string `json:"deployment"`
Job *string `json:"job"`
Index *int `json:"index"`
JobState string `json:"job_state"`
Vitals boshv... | package agent
import (
boshvitals "github.com/cloudfoundry/bosh-agent/platform/vitals"
)
// NodeID is no longer being used by the director as of completion of
// https://www.pivotaltracker.com/story/show/132265151
type Heartbeat struct {
Deployment string `json:"deployment"`
Job *string ... | Add comment noting removal of NodeID handling in director | Add comment noting removal of NodeID handling in director
[#132265151](https://www.pivotaltracker.com/story/show/132265151)
Signed-off-by: Rob Day-Reynolds <904086f049d807ae99640dbdfde98536a5822f56@pivotal.io>
| Go | apache-2.0 | mattcui/bosh-agent,cloudfoundry/bosh-agent,mattcui/bosh-agent,gu-bin/bosh-agent,gu-bin/bosh-agent,mattcui/bosh-agent,cloudfoundry/bosh-agent,gu-bin/bosh-agent |
4f3edf5103f7bbe83fca9eeba4b7382de7d29124 | solutions/slices.go | solutions/slices.go | // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "code.google.com/p/go-tour-french/pic"
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
for i := range p {
... | // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "github.com/dupoxy/go-tour-fr/pic"
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
for i := range p {
p[i... | Update imports from googlecode to github | Update imports from googlecode to github | Go | bsd-3-clause | dolmen/go-tour-fr,dupoxy/go-tour-fr,dupoxy/go-tour-fr,dolmen/go-tour-fr,dolmen/go-tour-fr,dupoxy/go-tour-fr |
d603bea6e9869e749b7122112351e532196b8c5a | generator/generator.go | generator/generator.go | package generator
import "os"
// Generator is in charge of generating files for packages.
type Generator struct {
filename string
}
// NewGenerator creates a new generator that can save on the given filename.
func NewGenerator(filename string) *Generator {
return &Generator{filename}
}
// Generate writes the file... | package generator
import (
"fmt"
"os"
)
// Generator is in charge of generating files for packages.
type Generator struct {
filename string
}
// NewGenerator creates a new generator that can save on the given filename.
func NewGenerator(filename string) *Generator {
return &Generator{filename}
}
// Generate wri... | Delete autogenerated kallax.go if generation failed | Delete autogenerated kallax.go if generation failed
| Go | mit | src-d/go-kallax |
5bb2af6cf06bbb3affb8ee05a1b05d0719e29594 | lib/randstr/randstr.go | lib/randstr/randstr.go | package randstr
import (
"crypto/rand"
"io"
)
// New generates a new random string of length given, using only the characters given in runes.
func New(length int, runes []rune) string {
password := make([]rune, length)
runesCount := len(runes)
byteCount := byteLen(runesCount)
bytes := make([]byte, byteCount)
... | package randstr
import (
"crypto/rand"
"io"
)
// New generates a new random string of length given, using only the characters given in runes.
func New(length int, runes []rune) string {
s := make([]rune, length)
runesCount := len(runes)
byteCount := byteLen(runesCount)
bytes := make([]byte, byteCount)
for i ... | Rename `password` to `s` in `New`. | Rename `password` to `s` in `New`.
What
===
Rename `password` to `s` in `New`.
Why
===
This package generates random strings not just passwords. Removing this
unnecessary concept.
| Go | mit | leighmcculloch/randstr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.