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 |
|---|---|---|---|---|---|---|---|---|---|
eb319d5b5bfc48cb685fafe5bd060d4ef3d90bbf | Problem001/Go/solution_1.go | Problem001/Go/solution_1.go | // Copyright 2016 the <project> Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "fmt"
func main() {
sum := 0
for i := 1; i < 1000; i++ {
if i%3 == 0 || i%5 == 0 {
sum += i
}
}
fmt.Println(sum)
}
| // Copyright 2016 the <project> Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "fmt"
func main() {
sum := 0
for i := 1; i < 1000; i++ {
if i%3 == 0 || i%5 == 0 {
sum += i
}
}
fmt.Println(sum)
}
| Remove useless space from Go solution problem 1 | Remove useless space from Go solution problem 1
| Go | mit | DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectE... |
403c02c9b295348c94073ed8c5ee2374b7bebfd0 | pkg/sys/executor_mock.go | pkg/sys/executor_mock.go | package sys
type MockExecutor struct {
Exec chan string
Args chan []string
OutStr chan string
OutErr chan error
}
func NewMockExecutor() *MockExecutor {
return &MockExecutor{
Exec: make(chan string, 1),
Args: make(chan []string, 1),
OutStr: make(chan string, 1),
OutErr: make(chan error, 1),
}
}
func ... | package sys
type MockExecutor struct {
Exec chan string
Args chan []string
OutStr chan string
OutErr chan error
}
func NewMockExecutor() *MockExecutor {
return &MockExecutor{
Exec: make(chan string, 1),
Args: make(chan []string, 1),
OutStr: make(chan string, 1),
OutErr: make(chan error, 1),
}
}
func ... | Add stub sys.Executor constructor from a func | Add stub sys.Executor constructor from a func
| Go | apache-2.0 | maxamillion/flamingo,maxamillion/flamingo,tmrts/flamingo,tmrts/flamingo |
65ca48cd8a947d0e80efa4bda726f0363352e5f9 | ginkgomon/helpers.go | ginkgomon/helpers.go | package ginkgomon
import (
"fmt"
"os"
"github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
func Invoke(runner ifrit.Runner) ifrit.Process {
process := ifrit.Background(runner)
select {
case <-process.Ready():
case err := <-process.Wait():
ginkgo.Fail(fmt.Sprintf("process failed... | package ginkgomon
import (
"fmt"
"os"
"github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
func Invoke(runner ifrit.Runner) ifrit.Process {
process := ifrit.Background(runner)
select {
case <-process.Ready():
case err := <-process.Wait():
ginkgo.Fail(fmt.Sprintf("process failed... | Add same check for Interrupt that exists for Kill | Add same check for Interrupt that exists for Kill
[#91746998]
| Go | mit | jfmyers9/ifrit,jenspinney/ifrit,lwoydziak/ifrit,tedsuo/ifrit |
7a6716f4ed3bb908d58443e7d9c5b24c648a5ab4 | pkg/sh/run.go | pkg/sh/run.go | // Copyright 2018 the u-root 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 sh
import (
"log"
"os"
"os/exec"
)
func RunOrDie(arg0 string, args ...string) {
cmd := exec.Command(arg0, args...)
cmd.Stdin = os.Stdin
cmd.S... | // Copyright 2018 the u-root 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 sh
import (
"log"
"os"
"os/exec"
)
// Run runs a command with stdin, stdout and stderr.
func Run(arg0 string, args ...string) error {
cmd := ex... | Add sh.Run function and documentation | Add sh.Run function and documentation
Signed-off-by: Ryan O'Leary <32139beaa9c574695821e85473b09a4e33316467@google.com>
| Go | bsd-3-clause | GanShun/u-root,hugelgupf/u-root,GanShun/u-root,hugelgupf/u-root,u-root/u-root,u-root/u-root,hugelgupf/u-root,GanShun/u-root,hugelgupf/u-root,u-root/u-root |
fb338508543ef3ccda74cd20e7ca4c39e1b64de2 | auth/basicauth_test.go | auth/basicauth_test.go | package auth
import (
"testing"
)
func TestHeaderParsing(t *testing.T) {
// Basic admin:password
authorization := "Basic YWRtaW46cGFzc3dvcmQ="
auth, err := parseAuthHeader(authorization)
if err != nil {
t.Error(err)
}
if auth.Name != "admin" {
t.Errorf("Detected name does not match: '%s'", auth.Name)
}
... | package auth
import (
"testing"
)
func TestHeaderParsing(t *testing.T) {
// Basic admin:password
authorization := "Basic YWRtaW46cGFzc3dvcmQ="
auth, err := parseAuthHeader(authorization)
if err != nil {
t.Error(err)
}
if auth.Name != "admin" {
t.Errorf("Detected name does not match: '%s'", auth.Name)
}
... | Add test for empty auth headers | Add test for empty auth headers
| Go | apache-2.0 | AaronO/go-git-http |
8151274669299c20b45d5199f7fde456181b711e | exit.go | exit.go | package mint
import (
"os"
"github.com/bouk/monkey"
)
// Exit ...
func (testee *Testee) Exit(expectedCode int) Result {
fun, ok := testee.actual.(func())
if !ok {
panic("mint error: Exit only can be called for func type value")
}
var actualCode int
patch := monkey.Patch(os.Exit, func(code int) {
actualC... | package mint
import (
"os"
"bou.ke/monkey"
)
// Exit ...
func (testee *Testee) Exit(expectedCode int) Result {
fun, ok := testee.actual.(func())
if !ok {
panic("mint error: Exit only can be called for func type value")
}
var actualCode int
patch := monkey.Patch(os.Exit, func(code int) {
actualCode = cod... | Use "bou.ke/monkey" instead of "github.com/bouk/monkey" | Use "bou.ke/monkey" instead of "github.com/bouk/monkey"
| Go | mit | otiai10/mint |
2129e4d7cbd99ad640258ac1809f9dc6ea7adf40 | transcode/transcode.go | transcode/transcode.go | package transcode
import (
"errors"
)
var (
// ErrInvalidCodec is returned when an invalid transcoder codec is selected
ErrInvalidCodec = errors.New("transcode: no such transcoder codec")
// ErrInvalidQuality is returned when an invalid quality is selected for a given codec
ErrInvalidQuality = errors.New("transc... | package transcode
import (
"errors"
"github.com/mdlayher/wavepipe/data"
)
var (
// ErrInvalidCodec is returned when an invalid transcoder codec is selected
ErrInvalidCodec = errors.New("transcode: no such transcoder codec")
// ErrInvalidQuality is returned when an invalid quality is selected for a given codec
... | Add more necessary methods to Transcoder interface | Add more necessary methods to Transcoder interface
| Go | mit | mdlayher/wavepipe,mdlayher/wavepipe |
44c42ff0f82ea73e4003c137f43cdc31854cc5fe | paths/paths_archives_test.go | paths/paths_archives_test.go | package paths
import (
"testing"
. "github.com/VonC/godbg"
. "github.com/smartystreets/goconvey/convey"
)
func TestArchive(t *testing.T) {
Convey("Tests for Uncompress", t, func() {
Convey("Uncompress fails if p is a folder", func() {
p := NewPath(".")
SetBuffers(nil)
b := p.Uncompress(nil)
So(b,... | package paths
import (
"testing"
. "github.com/VonC/godbg"
. "github.com/smartystreets/goconvey/convey"
)
func TestArchive(t *testing.T) {
Convey("Tests for Uncompress", t, func() {
Convey("Uncompress fails if p is a folder", func() {
p := NewPath(".")
SetBuffers(nil)
b := p.Uncompress(nil)
So(b,... | Test Path.Uncompress when p is not a zip file. | Test Path.Uncompress when p is not a zip file.
| Go | mit | VonC/senvgo,VonC/senvgo |
8bce574cbba60f3412fc4f4a86d768bac077ac69 | ct/go/ctfe/task_types/task_types.go | ct/go/ctfe/task_types/task_types.go | /*
List of all task types.
*/
package task_types
import (
"go.skia.org/infra/ct/go/ctfe/admin_tasks"
"go.skia.org/infra/ct/go/ctfe/capture_skps"
"go.skia.org/infra/ct/go/ctfe/chromium_analysis"
"go.skia.org/infra/ct/go/ctfe/chromium_builds"
"go.skia.org/infra/ct/go/ctfe/chromium_perf"
"go.skia.org/infra/ct/go/... | /*
List of all task types.
*/
package task_types
import (
"go.skia.org/infra/ct/go/ctfe/admin_tasks"
"go.skia.org/infra/ct/go/ctfe/capture_skps"
"go.skia.org/infra/ct/go/ctfe/chromium_analysis"
"go.skia.org/infra/ct/go/ctfe/chromium_builds"
"go.skia.org/infra/ct/go/ctfe/chromium_perf"
"go.skia.org/infra/ct/go/... | Add pixel diff to list of recognized tasks | Add pixel diff to list of recognized tasks
BUG=skia:6778
Change-Id: I61a9562930516f88e1f6308d9a36eda4978f129a
Reviewed-on: https://skia-review.googlesource.com/20600
Reviewed-by: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@google.com>
Commit-Queue: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@googl... | 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 |
026d0d2b73b4fde694c4e4430c70dc905078b921 | main.go | main.go | package main
import (
"os"
"io/ioutil"
"github.com/hashicorp/hcl/json/parser"
"github.com/hashicorp/hcl/hcl/printer"
)
func main() {
input, _ := ioutil.ReadAll(os.Stdin)
ast, err := parser.Parse([]byte(input))
if err != nil {
panic(err)
}
err = printer.Fprint(os.Stdout, ast)
if err != nil {
... | package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/hashicorp/hcl/hcl/printer"
"github.com/hashicorp/hcl/json/parser"
)
func main() {
if err := convert(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func convert() error {
input, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return... | Implement proper error handling and output | Implement proper error handling and output
| Go | mit | kvz/json2hcl |
42f7376d6e68381e88650dfc85d5df9b60ac056b | main.go | main.go | package main
import (
"os"
"strings"
"time"
)
func main() {
clients := strings.Split(os.Getenv("XLANG_CLIENTS"), ",")
servers := strings.Split(os.Getenv("XLANG_SERVERS"), ",")
behaviors := strings.Split(os.Getenv("XLANG_BEHAVIORS"), ",")
matrix := Matrix{
Clients: clients,
Servers: servers,
Behavio... | package main
import (
"fmt"
"os"
"strings"
"time"
)
func main() {
clients := strings.Split(os.Getenv("XLANG_CLIENTS"), ",")
servers := strings.Split(os.Getenv("XLANG_SERVERS"), ",")
behaviors := strings.Split(os.Getenv("XLANG_BEHAVIORS"), ",")
matrix := Matrix{
Clients: clients,
Servers: servers,
... | Add messages around synchronizing clients | Add messages around synchronizing clients
| Go | mit | yarpc/crossdock,yarpc/crossdock,crossdock/crossdock,yarpc/crossdock,crossdock/crossdock,crossdock/crossdock |
e90afb69db7362966deb69251c240bc33609f97b | compiler/expression.go | compiler/expression.go | package compiler
type Expression struct {
Name Translatable
OnScan func(*Compiler) Type
Detect func(*Compiler) *Type
}
func (c *Compiler) scanExpression() Type {
var token = c.Scan()
for _, expression := range c.Expressions {
if expression.Name[c.Language] == token {
return expression.OnScan(c)
}
}
... | package compiler
type Expression struct {
Name Translatable
OnScan func(*Compiler) Type
Detect func(*Compiler) *Type
}
func (c *Compiler) Expression() Type {
var token = c.Scan()
for _, expression := range c.Expressions {
if expression.Name[c.Language] == token {
return expression.OnScan(c)
}
}
fo... | Allow Expression to be called as a Shuntless alternative to ScanExpression | Allow Expression to be called as a Shuntless alternative to ScanExpression
| Go | bsd-3-clause | Qlova/uct |
ea12a4c8c3d5fb880ab81c6cd169aba63732b536 | src/how/request/request_test.go | src/how/request/request_test.go | package request
import (
"github.com/franela/goblin"
"testing"
)
func Test(t *testing.T) {
g := goblin.Goblin(t)
g.Describe("Get", func() {
g.It("Errors when connection refused", func() {
_, err := Get("http://localhost", map[string]string{
"foo": "bar",
})
g.Assert(err.Error()).Equal("Get http://... | package request
import (
"github.com/franela/goblin"
"testing"
)
func Test(t *testing.T) {
g := goblin.Goblin(t)
g.Describe("Get", func() {
g.It("Errors when connection refused", func() {
_, err := Get("http://localhost:8000", map[string]string{
"foo": "bar",
})
g.Assert(err.Error()).Equal("Get ht... | Adjust port so that test doesn't fail on my local machine 😄 | Adjust port so that test doesn't fail on my local machine 😄
| Go | mit | BrettBukowski/how |
0dbc3f39281c135cd100474b7d2ca2368767036f | cmd/pkg/mc/project_suite_test.go | cmd/pkg/mc/project_suite_test.go | package mc
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestMC(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "MC Suite")
}
| package mc
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os"
"testing"
)
func TestMC(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "MC Suite")
}
var _ = BeforeSuite(func() {
os.RemoveAll(".materialscommons")
os.RemoveAll("/tmp/mcdir")
})
var _ = AfterSuite(func() {
// os.RemoveAl... | Add Before and After Suite calls to clean up items. | Add Before and After Suite calls to clean up items.
| Go | mit | materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore |
00297b35c0c433e7caf3502c5402343e2812482b | main.go | main.go | package main
import (
"log"
"net/http"
)
func main() {
router := NewRouter()
log.Fatal(http.ListenAndServe(":80", router))
}
| package main
import (
"flag"
"fmt"
"log"
"net/http"
"strconv"
)
func main() {
router := NewRouter()
port := flag.Int("port", 8080, "Port to run on")
flag.Parse()
if *port < 1 || *port > 65536 {
log.Fatal(string(*port) + " is not a valid port number. Exiting.")
}
portString := ":" + strconv.Itoa(*port)... | Support specifying port as command-line flag on startup | Support specifying port as command-line flag on startup
| Go | mit | bjschafer/easy-notifier |
c18a27791884dbf069c1c6430562eec8fda4b345 | util.go | util.go | /*
* Copyright 2016 Frank Wessels <fwessels@xs4all.nl>
*
* 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 appli... | /*
* Copyright 2016 Frank Wessels <fwessels@xs4all.nl>
*
* 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 appli... | Split MakeUnique function (to allow for more generic use, eg. commits as well) | Split MakeUnique function (to allow for more generic use, eg. commits as well)
| Go | apache-2.0 | s3git/s3git-go |
16be18d7f439e5fd87e121fa370a36eb4e229f1e | main.go | main.go | // Copyright 2016-2021 terraform-provider-sakuracloud 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 b... | // Copyright 2016-2021 terraform-provider-sakuracloud 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 b... | Support for Debuggable Provider Binaries - added -debuggable flag | Support for Debuggable Provider Binaries - added -debuggable flag
| Go | apache-2.0 | sacloud/terraform-provider-sakuracloud,sacloud/terraform-provider-sakuracloud |
6cd28e734c926178868dd572a79524d174daa070 | autoprofile/internal/timer_test.go | autoprofile/internal/timer_test.go | package internal_test
import (
"testing"
"time"
"github.com/instana/go-sensor/autoprofile/internal"
"github.com/stretchr/testify/assert"
)
func TestTimer_Restart(t *testing.T) {
var fired int
timer := internal.NewTimer(0, 20*time.Millisecond, func() {
fired++
})
time.Sleep(30 * time.Millisecond)
timer.St... | package internal_test
import (
"sync/atomic"
"testing"
"time"
"github.com/instana/go-sensor/autoprofile/internal"
"github.com/stretchr/testify/assert"
)
func TestTimer_Restart(t *testing.T) {
var fired int64
timer := internal.NewTimer(0, 20*time.Millisecond, func() {
atomic.AddInt64(&fired, 1)
})
time.Sl... | Fix data races in internal.Timer tests | Fix data races in internal.Timer tests
| Go | mit | instana/golang-sensor,instana/golang-sensor |
bf8a83a8dfa78e23c84ed1af8c3171aa31a05d42 | main.go | main.go | package main
import (
"fmt"
)
func handleMessages(in <-chan Message) {
for {
msg := <-in
fmt.Println("Got message\n", msg, "\n")
}
}
func main() {
messages := make(chan Message)
server := NewServer(messages, SMTPConfig{
Ip4address: "127.0.0.1",
Ip4port: 25,
Domain: "local",
All... | package main
import (
"fmt"
)
func handleMessages(in <-chan Message) {
for {
msg := <-in
fmt.Println("Got message\n", msg, "\n")
}
}
func main() {
messages := make(chan Message)
server := NewServer(messages, SMTPConfig{
Ip4address: "127.0.0.1",
Ip4port: 25,
Domain: "local",
All... | Remove the stupid fake spam detection crap why is this even here holy fuuuuuuuuu | Remove the stupid fake spam detection crap why is this even here holy fuuuuuuuuu
| Go | mit | StratumSecurity/gosmtpd |
52b06cdbe50bde89870b3a4419798449f04dea0c | config/config.go | config/config.go | package config
import (
"io/ioutil"
"github.com/cloudfoundry-incubator/candiedyaml"
)
type RoutingAPIConfig struct {
URI string `yaml:"uri"`
Port int `yaml:"port"`
AuthDisabled bool `yaml:"auth_disabled"`
}
type OAuthConfig struct {
TokenEndpoint string `yaml:"token_endpoint"`
Port ... | package config
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type RoutingAPIConfig struct {
URI string `yaml:"uri"`
Port int `yaml:"port"`
AuthDisabled bool `yaml:"auth_disabled"`
}
type OAuthConfig struct {
TokenEndpoint string `yaml:"token_endpoint"`
Port int `yaml:"po... | Switch to go-yaml library from candiedyaml | Switch to go-yaml library from candiedyaml
[#126429343]
| Go | apache-2.0 | cloudfoundry-incubator/cf-tcp-router,cloudfoundry-incubator/cf-tcp-router |
2c70fa70727c953c51695f800f25d6b44abb368e | pass.go | pass.go | package gopass
import (
"os"
)
// getPasswd returns the input read from terminal.
// If masked is true, typing will be matched by asterisks on the screen.
// Otherwise, typing will echo nothing.
func getPasswd(masked bool) []byte {
var pass, bs, mask []byte
if masked {
bs = []byte("\b \b")
mask = []byte("*")
... | package gopass
import (
"os"
)
// getPasswd returns the input read from terminal.
// If masked is true, typing will be matched by asterisks on the screen.
// Otherwise, typing will echo nothing.
func getPasswd(masked bool) []byte {
var pass, bs, mask []byte
if masked {
bs = []byte("\b \b")
mask = []byte("*")
... | Fix issue where some how NUL (0 byte) is returned from getch on windows. | Fix issue where some how NUL (0 byte) is returned from getch on windows.
The "fix" is to basically ignore the zero byte.
| Go | isc | keybase/gopass,howeyc/gopass,yp-engineering/gopass |
2bb2a1ef4e09367b6136436dd6fcb3133b33113d | generation/testdata/listing/main.go | generation/testdata/listing/main.go | // Package main is used for testing of generated 'views' listing.
// There is no way to include a new import dynamically, thus
// we are running this test from generate_test.go
// as a new command using exec package.
package main
import (
"../assets/views"
"github.com/anonx/sunplate/log"
)
func main() {
if l := l... | // Package main is used for testing of generated 'views' listing.
// There is no way to include a new import dynamically, thus
// we are running this test from generate_test.go
// as a new command using exec package.
package main
import (
"../assets/views"
"github.com/anonx/sunplate/log"
)
func main() {
if l := l... | Update expected results of generated liting | Update expected results of generated liting
| Go | bsd-2-clause | runner-mei/goal,runner-mei/goal,runner-mei/goal |
65107264ff7d46eabb8cc34eb4a763a7b4f74b19 | sacloud/types/vpc_router_plan.go | sacloud/types/vpc_router_plan.go | // Copyright 2016-2019 The Libsacloud 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... | // Copyright 2016-2019 The Libsacloud 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... | Add 4,000Mbps plan to VPCRouter | Add 4,000Mbps plan to VPCRouter
| Go | apache-2.0 | sacloud/libsacloud |
d12f0ece30d18923c7a4ed858036e003de27cb3c | pkg/db/model/models.go | pkg/db/model/models.go | package model
import (
"github.com/materials-commons/mcstore/pkg/db/schema"
)
// Groups is a default model for the usergroups table.
var Groups = &rModel{
schema: schema.Group{},
table: "usergroups",
}
// Users is a default model for the users table.
var Users = &rModel{
schema: schema.User{},
table: "users",... | package model
import (
"github.com/materials-commons/mcstore/pkg/db/schema"
)
// Groups is a default model for the usergroups table.
var Groups = &rModel{
schema: schema.Group{},
table: "usergroups",
}
// Users is a default model for the users table.
var Users = &rModel{
schema: schema.User{},
table: "users",... | Add model definitions for join tables. | Add model definitions for join tables.
| Go | mit | materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore |
2c0a355ba4328baae3e266d06f2b29c9efff996e | main.go | main.go | package main
import (
"fmt"
"os"
"github.com/Cepave/open-falcon-backend/cmd"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)
var versionFlag bool
var RootCmd = &cobra.Command{
Use: "open-falcon",
}
func init() {
RootCmd.AddCommand(cmd.Start)
RootCmd.AddCommand(cmd.Stop)
RootCmd.AddCommand(cmd.Res... | package main
import (
"fmt"
"os"
"github.com/Cepave/open-falcon-backend/cmd"
"github.com/spf13/cobra"
)
var versionFlag bool
var RootCmd = &cobra.Command{
Use: "open-falcon",
Run: func(cmd *cobra.Command, args []string) {
if versionFlag {
fmt.Printf("Open-Falcon version %s, build %s\n", Version, GitCommi... | Fix the flags of subcommands | [OWL-998][backend] Fix the flags of subcommands
| Go | apache-2.0 | Cepave/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-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open... |
422853f483e5b0c5760c8ddc0d6301b5ea3c33a5 | main.go | main.go | package main
import (
"github.com/albertyw/reaction-pics/server"
"github.com/albertyw/reaction-pics/tumblr"
_ "github.com/joho/godotenv/autoload"
"os"
"strings"
)
const readPostsFromTumblrEnv = "READ_POSTS_FROM_TUMBLR"
func getReadPostsFromTumblr() bool {
readPostsEnv := os.Getenv(readPostsFromTumblrEnv)
if s... | package main
import (
"github.com/albertyw/reaction-pics/server"
"github.com/albertyw/reaction-pics/tumblr"
_ "github.com/joho/godotenv/autoload"
"os"
"strings"
)
const readPostsFromTumblrEnv = "READ_POSTS_FROM_TUMBLR"
func getReadPostsFromTumblr() bool {
readPostsEnv := os.Getenv(readPostsFromTumblrEnv)
if s... | Split post channel for server and writing to csv | Split post channel for server and writing to csv
| Go | mit | albertyw/reaction-pics,albertyw/reaction-pics,albertyw/reaction-pics,albertyw/devops-reactions-index,albertyw/devops-reactions-index,albertyw/devops-reactions-index,albertyw/reaction-pics,albertyw/devops-reactions-index |
286e0c5e776e9eaaa294b07ffeae832a2117195e | main.go | main.go | package main
import "github.com/couchbaselabs/sgload/cmd"
func main() {
cmd.Execute()
}
| package main
import (
"net/http"
_ "expvar"
"github.com/couchbaselabs/sgload/cmd"
)
func main() {
// Expose expvars via http -- needed by mobile-testkit to figure out
// when the process is finished.
go func() {
http.ListenAndServe(":9876", http.DefaultServeMux)
}()
cmd.Execute()
}
| Add expvar endpoint to all sgload commands | Add expvar endpoint to all sgload commands
| Go | apache-2.0 | couchbaselabs/sgload |
2b740d65f865a64a0dc206fec4d7dd83c46b2c43 | main.go | main.go | package main
import (
"github.com/solidfire/solidfire-docker-driver/sfapi"
"github.com/solidfire/solidfire-docker-driver/sfcli"
"os"
)
const (
VERSION = "1.0.0"
)
var (
client *sfapi.Client
)
func main() {
cli := sfcli.NewCli(VERSION)
cli.Run(os.Args)
}
| package main
import (
"github.com/solidfire/solidfire-docker-driver/sfapi"
"github.com/solidfire/solidfire-docker-driver/sfcli"
"os"
)
const (
VERSION = "1.2.0"
)
var (
client *sfapi.Client
)
func main() {
cli := sfcli.NewCli(VERSION)
cli.Run(os.Args)
}
| Make the declared version 1.2 | Make the declared version 1.2
(Same as the current "release", not sure if the value should be incremented) | Go | apache-2.0 | ebalduf/solidfire-docker-driver,solidfire/solidfire-docker-driver,ebalduf/solidfire-docker-driver,solidfire/solidfire-docker-driver |
1f6d2ea7f827e3c56a5df7deae5dfbf73e71f0d8 | main.go | main.go | package main
import (
"log"
"os"
"go/ast"
"go/parser"
"go/token"
)
func validator(name string, s *ast.StructType) {
log.Print(name)
for _, fld := range(s.Fields.List) {
nam := fld.Names[0].Name
typ := fld.Type.(*ast.Ident)
log.Printf("%s %s", nam, typ)
}
}
func main() {
log.SetFlags(0)
fs := token.... | package main
import (
"log"
"os"
"fmt"
"go/ast"
"go/parser"
"go/token"
)
func validator(name string, s *ast.StructType) {
fmt.Println(name)
for _, fld := range(s.Fields.List) {
nam := fld.Names[0].Name
typ := fld.Type.(*ast.Ident)
fmt.Printf("%s %s\n", nam, typ)
}
}
func main() {
log.SetFlags(0)
f... | Send actual output to standard out instead of error. | Send actual output to standard out instead of error.
| Go | mit | crunchyroll/govalid |
f1d57e261b00512dde2c576087ed56b9e621342a | main.go | main.go | /*
* Copyright (c) 2014 PolyFloyd
*/
package main
import "flag"
const (
INFO = "PolyFloyd's LEDCube Simulator v0.1"
UI_DETAIL int = 2
UI_DRAGDIV float32 = 240.0
UI_FOVY float32 = 45.0
UI_SPACING float32 = 8.0
UI_WIN_H int = 768
UI_WIN_W int = 1280
UI_ZFAR float32... | /*
* Copyright (c) 2014 PolyFloyd
*/
package main
import "flag"
const (
INFO = "PolyFloyd's LEDCube Simulator v0.1"
UI_DETAIL int = 1
UI_DRAGDIV float32 = 240.0
UI_FOVY float32 = 45.0
UI_SPACING float32 = 8.0
UI_WIN_H int = 768
UI_WIN_W int = 1280
UI_ZFAR float32... | Decrease detail to increase performance | Decrease detail to increase performance
| Go | mit | PolyFloyd/ledcubesim,PolyFloyd/ledcubesim,PolyFloyd/ledcubesim |
2f13ce1b0cd23ff8c58de126e3df4c79521bbfa4 | wait_group.go | wait_group.go | // Package throttled implements various helpers to manage the lifecycle of goroutines.
package throttled
// WaitGroup limits the number of concurrent goroutines.
type WaitGroup struct {
throttle int
completed chan bool
outstanding int
}
// NewWaitGroup instantiates a new WaitGroup with the given throttle.
fun... | // Package throttled implements various helpers to manage the lifecycle of goroutines.
package throttled
// WaitGroup limits the number of concurrent goroutines that can execute at once.
type WaitGroup struct {
throttle int
completed chan bool
outstanding int
}
// NewWaitGroup instantiates a new WaitGroup wit... | Add bugfix - needed to increment outstanding at point of add | Add bugfix - needed to increment outstanding at point of add
| Go | mit | suicidejack/throttled |
304401ac63884cee76ea44634aa813bc7d117c03 | common/proto/milo/util.go | common/proto/milo/util.go | // Copyright 2015 The LUCI 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... | // Copyright 2015 The LUCI 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... | Add source manifest content type | [milo][proto] Add source manifest content type
This change adds a constant for a source manifest content type.
Change-Id: I0225a411721fc45695dc55e5f375c8c21d8878c4
Reviewed-on: https://chromium-review.googlesource.com/1072795
Reviewed-by: Nodir Turakulov <ef4933a197ef7b4b3f55f1bec4942aead3637a2a@chromium.org>
Commit-... | Go | apache-2.0 | luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go |
03eaf0db4f57a6f17f875a34ac5de26dc5dea0a0 | main.go | main.go | package main
import (
"github.com/Sirupsen/logrus"
"github.com/verath/archipelago/lib"
"golang.org/x/net/context"
"os"
"os/signal"
)
func main() {
log := logrus.New()
log.Level = logrus.DebugLevel
log.Formatter = &logrus.TextFormatter{}
ctx, halt := context.WithCancel(context.Background())
// Listen for i... | package main
import (
"github.com/Sirupsen/logrus"
"github.com/verath/archipelago/lib"
"os"
"os/signal"
"context"
)
func main() {
log := logrus.New()
log.Level = logrus.DebugLevel
log.Formatter = &logrus.TextFormatter{}
ctx, halt := context.WithCancel(context.Background())
// Listen for interrupts
sigs :... | Use context from std lib. | Use context from std lib.
| Go | mit | verath/archipelago,verath/archipelago,verath/archipelago |
0c4797c1520bd3d3da36368749b1847b6dac33df | main.go | main.go | package main
import "github.com/waltzofpearls/relay-api/rapi"
func main() {
api := rapi.New("/v1").
setListenProtocol("http").
setListenAddr("localhost:8080").
setDownstreamProtocol("http").
setDownstreamAddr("localhost:8094")
api.NewEndpoint("GET", "/users")
api.Run()
}
| package main
import "github.com/waltzofpearls/relay-api/rapi"
func main() {
api := rapi.New("/v1").
setListenAddr("http://localhost:8080").
setDownstreamAddr("http://localhost:8094")
api.NewEndpoint("GET", "/users")
api.Run()
}
| Simplify listening address and downstream setters | Simplify listening address and downstream setters
| Go | mit | waltzofpearls/relay-api |
38d98b5520be54d8af491557271c460cc22553c2 | main.go | main.go | package main
import (
log "github.com/Sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
"github.com/siebenmann/go-kstat"
"net/http"
"time"
)
func collectARCstats() {
log.Debugf("Start collecting ARC stats")
token, err := kstat.Open()
if err != nil {
log.Fatalf("Open failure: %s", err)
}
fo... | package main
import (
log "github.com/Sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
"github.com/siebenmann/go-kstat"
"net/http"
"time"
)
func collectARCstats() {
log.Debugf("Start collecting ARC stats")
token, err := kstat.Open()
if err != nil {
log.Fatalf("Open failure: %s", err)
}
fo... | Read hits and misses stats | Read hits and misses stats
| Go | apache-2.0 | ingrians/smartos_exporter,ingrians/smartos_exporter |
0b7585e2f60b0b710e6dc1e86daff21b9ee20c9a | main.go | main.go | package main
import (
"log"
"os"
docker "github.com/fsouza/go-dockerclient"
)
func getEnvVar(name, defval string) string {
val := os.Getenv(name)
if val == "" {
val = defval
}
return val
}
func main() {
host := os.Getenv("DOCKER_HOST")
if host == "" {
log.Fatalln("Please provide DOCKER_HOST environment... | package main
import (
"log"
"os"
docker "github.com/fsouza/go-dockerclient"
)
const VERSION = "0.4.0"
func getEnvVar(name, defval string) string {
val := os.Getenv(name)
if val == "" {
val = defval
}
return val
}
func main() {
host := os.Getenv("DOCKER_HOST")
if host == "" {
log.Fatalln("Please provid... | Introduce version: 0.4.0, this is a fourth edition so far | Introduce version: 0.4.0, this is a fourth edition so far
| Go | mit | sosedoff/docker-gateway |
6f2375c97130fc61eb62d9691ecd31878a68361f | misc.go | misc.go | package anidb
import (
"github.com/Kovensky/go-fscache"
"strconv"
"strings"
"time"
)
type MyListStats struct {
Anime int
Episodes int
Files int
Filesize int64
AddedAnime int
AddedEpisodes int
AddedFiles int
AddedGroups int
Leech float32 // rate of Files to A... | package anidb
import (
"time"
)
type MyListStats struct {
Anime int
Episodes int
Files int
Filesize int64
AddedAnime int
AddedEpisodes int
AddedFiles int
AddedGroups int
Leech float32 // rate of Files to AddedFiles
Glory float32 // meaning undocume... | Remove unused imports, fixes compilation | anidb: Remove unused imports, fixes compilation
| Go | mit | Kovensky/go-anidb |
e91fa495631ff75320600c47c8a2f19614038247 | observers/apple_observer.go | observers/apple_observer.go | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/apple"
"github.com/ivan1993spb/snake-server/world"
)
const chanAppleObserverEventsBuffer = 32
const defaultAppleCount = 1
const oneAppleArea = 50
type AppleObserver struct{}
func (AppleObserver) Observe(stop <... | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/apple"
"github.com/ivan1993spb/snake-server/world"
)
const chanAppleObserverEventsBuffer = 32
const defaultAppleCount = 1
const oneAppleArea = 50
type AppleObserver struct{}
func (AppleObserver) Observe(stop <... | Fix apple observer to create apple in starting goroutine | Fix apple observer to create apple in starting goroutine
| Go | bsd-2-clause | ivan1993spb/clever-snake |
580ad7505adadb621210f3461feb343499fea35e | pool.go | pool.go | package cartel
import (
"sync"
)
type Pool struct {
Input chan Task
Output chan OutputValue
wg *sync.WaitGroup
}
func (p Pool) End() {
close(p.Input)
p.wg.Wait()
}
func (p Pool) Do(t Task) {
p.Input <- t
}
func (p Pool) GetOutput() []OutputValue {
values := []OutputValue{}
for {
select {
case r, ... | package cartel
import (
"sync"
"time"
)
type Pool struct {
Input chan Task
Output chan OutputValue
wg *sync.WaitGroup
}
func (p Pool) End() {
close(p.Input)
p.wg.Wait()
}
func (p Pool) Do(t Task) {
p.Input <- t
}
func (p Pool) GetOutput() []OutputValue {
values := []OutputValue{}
for {
select {
... | Add time limit for worker threads | Add time limit for worker threads
| Go | mit | icambridge/cartel |
f2826b8ce9191b18e4abbd1d07df74852256d821 | server/sms/sms.go | server/sms/sms.go | package sms
import "encoding/json"
type NexmoSms struct {
ApiKey string `json:"api_key"`
ApiSecret string `json:"api_secret"`
To string `json:"to"`
From string `json:"from"`
SmsBody string `json:"text"`
}
func (sms *NexmoSms) EncodeNexmoSms(apiKey, apiSecret string) ([]byte, error) {
sms.ApiKe... | package sms
import "encoding/json"
type NexmoSms struct {
ApiKey string `json:"api_key"`
ApiSecret string `json:"api_secret"`
To string `json:"to"`
From string `json:"from"`
Text string `json:"text"`
}
func (sms *NexmoSms) EncodeNexmoSms(apiKey, apiSecret string) ([]byte, error) {
sms.ApiKe... | Modify field to match json | Modify field to match json
| Go | mit | cosminrentea/gobbler,smancke/guble,cosminrentea/gobbler,smancke/guble |
9cf7790aa0f2af9638042bd5e72b293556100cef | rows.go | rows.go | package testdb
import (
"database/sql/driver"
"io"
)
type rows struct {
closed bool
columns []string
rows [][]driver.Value
pos int
}
func (rs *rows) clone() *rows {
if rs == nil {
return nil
}
return &rows{closed: false, columns: rs.columns, rows: rs.rows, pos: 0}
}
func (rs *rows) Next(dest []d... | package testdb
import (
"database/sql/driver"
"io"
)
type rows struct {
closed bool
columns []string
rows [][]driver.Value
pos int
}
func (rs *rows) clone() *rows {
if rs == nil {
return nil
}
return &rows{closed: false, columns: rs.columns, rows: rs.rows, pos: 0}
}
func (rs *rows) Next(dest []d... | Remove position resetting from fork after upstream clone solution | Remove position resetting from fork after upstream clone solution
| Go | bsd-2-clause | rafaeljusto/go-testdb |
44b27151d86c9a58b271b7f3bcae6fbd93a8e5a1 | wiki.go | wiki.go | package main
import (
"fmt"
"io/ioutil"
)
type Page struct {
Title string
Body []byte
}
func (p *Page) save() error {
filename := p.Title + ".txt"
return ioutil.WriteFile(filename, p.Body, 0600)
}
func loadPage(title string) (*Page, error) {
filename := title + ".txt"
body, err := ioutil.ReadFile(filename)... | package main
import (
"fmt"
"io/ioutil"
"net/http"
)
const viewPath = "/view/"
type Page struct {
Title string
Body []byte
}
func (p *Page) save() error {
filename := p.Title + ".txt"
return ioutil.WriteFile(filename, p.Body, 0600)
}
func loadPage(title string) (*Page, error) {
filename := title + ".txt"
... | Add a simple view method | Add a simple view method
| Go | mit | tylrtrmbl/gowiki |
a4630ec28c790dd1be785f097d0268c4aa4a423f | compiler/version_check.go | compiler/version_check.go | // +build go1.16
package compiler
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
)
// Version is the GopherJS compiler version string.
const Version = "1.16.0+go1.16.3"
// GoVersion is the current Go 1.x version that GopherJS is compatible with.
const GoVersion = 16
// CheckGoVersion check... | // +build go1.16
package compiler
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
)
// Version is the GopherJS compiler version string.
const Version = "1.16.1+go1.16.3"
// GoVersion is the current Go 1.x version that GopherJS is compatible with.
const GoVersion = 16
// CheckGoVersion check... | Increment GopherJS version to 1.16.1. | Increment GopherJS version to 1.16.1.
| Go | bsd-2-clause | gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs |
bad5c39c97cc716bc142675490a897390c9670a3 | models/dump_token_test.go | models/dump_token_test.go | package models_test
import (
"encoding/json"
"github.com/herald-it/goncord/models"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNewDumpTokenModel(t *testing.T) {
dump_token := &models.DumpToken{}
Convey("Create new dump token", t, func() {
So(dump_token, ShouldNotBeNil)
})
}
func TestJ... | package models_test
import (
"encoding/json"
"github.com/herald-it/goncord/models"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNewDumpTokenModel(t *testing.T) {
Convey("Create new dump token", t, func() {
dump_token := &models.DumpToken{}
So(dump_token, ShouldNotBeNil)
})
}
func TestJ... | Change test fraemwork on Convey. | Change test fraemwork on Convey.
| Go | mit | herald-it/goncord |
9f1516b716a2fdd847eff7cdb85821f85af8a250 | db/db.go | db/db.go | package db
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"github.com/open-falcon/hbs/g"
"log"
)
var DB *sql.DB
func Init() {
err := dbInit(g.Config().Database)
if err != nil {
log.Fatalf("open db fail: %v", err)
}
DB.SetMaxIdleConns(g.Config().MaxIdle)
}
func dbInit(dsn string) (err error) ... | package db
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/open-falcon/hbs/g"
"log"
)
var DB *sql.DB
func Init() {
err := dbInit(g.Config().Database)
if err != nil {
log.Fatalln(err)
}
DB.SetMaxIdleConns(g.Config().MaxIdle)
}
func dbInit(dsn string) (err error) {
if DB, er... | Fix ambiguous message while connecting to database | [OWL-277] Fix ambiguous message while connecting to database
| Go | apache-2.0 | Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/hbs,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/hbs,masato25/open-falcon-backend,masato25/open-falc... |
dbfa1f3a0017dc87d1350bde00c2d18eceb95788 | imgscale/image_provider_http_test.go | imgscale/image_provider_http_test.go | package imgscale
import (
"github.com/stretchr/testify/assert"
"testing"
"net/http"
"net/http/httptest"
"fmt"
)
func TestHttpFetchOK(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "../data/kth.jpg")
}))
defer ts.Close()
fmt.Prin... | package imgscale
import (
"github.com/stretchr/testify/assert"
"testing"
"net/http"
"net/http/httptest"
)
func TestHttpFetchOK(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "../data/kth.jpg")
}))
defer ts.Close()
provider := N... | Test case with none empty base url | Test case with none empty base url | Go | mit | vanng822/imgscale |
ec4697ea3379b79cef47f50cac44efee283b5ace | libmachine/provision/redhat_ssh_commander.go | libmachine/provision/redhat_ssh_commander.go | package provision
import (
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/ssh"
)
type RedHatSSHCommander struct {
Driver drivers.Driver
}
func (sshCmder RedHatSSHCommander) SSHCommand(args string) (string, error) {
client, err := drivers.GetSSHClientFromDriver(sshCmder.Drive... | package provision
import (
"fmt"
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/log"
"github.com/docker/machine/libmachine/ssh"
)
type RedHatSSHCommander struct {
Driver drivers.Driver
}
func (sshCmder RedHatSSHCommander) SSHCommand(args string) (string, error) {
client, ... | Add SSH logs when provisioning with RedHat derivatives | Add SSH logs when provisioning with RedHat derivatives
Fixes #3507
Signed-off-by: KOBAYASHI Shinji <f11af612650f474cce319970f68085816c4c9a70@jp.fujitsu.com>
| Go | apache-2.0 | gdevillele/docker.github.io,anweiss/docker.github.io,bgokden/machine,docker-zh/docker.github.io,gdevillele/docker.github.io,shin-/docker.github.io,BSWANG/denverdino.github.io,londoncalling/docker.github.io,bdwill/docker.github.io,aduermael/docker.github.io,troy0820/docker.github.io,wzymaster/machine,aduermael/docker.gi... |
37bb7e70b0002d30171272ff4c454829c762a79e | p1.go | p1.go | package main
import (
"bufio"
"io"
)
type P1 struct {
rd *bufio.Reader
}
// NewReader returns a Reader whose read telegrams from a Reader object.
func NewP1(rd io.Reader) P1 {
return P1{rd: bufio.NewReader(rd)}
}
// Read reads data into p. It returns the number of bytes read into p. It reads
// till it encounte... | package main
import (
"bufio"
"io"
)
type P1 struct {
rd *bufio.Reader
}
// NewReader returns a Reader whose read telegrams from a Reader object.
func NewP1(rd io.Reader) P1 {
return P1{rd: bufio.NewReader(rd)}
}
// Read reads data into p. It returns the number of bytes read into p. It reads
// till it encounte... | Fix P1 so it adheres Reader interface. | Fix P1 so it adheres Reader interface.
| Go | mit | OrangeTux/carrot |
3618d2d293a0ec9080cb71de74d879e1c2ab7bfe | db/db.go | db/db.go | package db
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"github.com/open-falcon/hbs/g"
"log"
)
var DB *sql.DB
func Init() {
err := dbInit(g.Config().Database)
if err != nil {
log.Fatalf("open db fail: %v", err)
}
DB.SetMaxIdleConns(g.Config().MaxIdle)
}
func dbInit(dsn string) (err error) ... | package db
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/open-falcon/hbs/g"
"log"
)
var DB *sql.DB
func Init() {
err := dbInit(g.Config().Database)
if err != nil {
log.Fatalln(err)
}
DB.SetMaxIdleConns(g.Config().MaxIdle)
}
func dbInit(dsn string) (err error) {
if DB, er... | Fix ambiguous message while connecting to database | [OWL-277] Fix ambiguous message while connecting to database
| Go | apache-2.0 | masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/hbs,Cepave/hbs,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falc... |
e5dc220fb707651888fec980944f7b739b59fc02 | petze.go | petze.go | package main
import (
"flag"
"os"
"github.com/foomo/petze/service"
"github.com/foomo/petze/config"
log "github.com/sirupsen/logrus"
)
func main() {
flag.Usage = usage
flag.Parse()
if flag.NArg() != 1 {
flag.Usage()
os.Exit(1)
}
configurationDirectory := os.Args[1]
if stat, err := os.Stat(configuratio... | package main
import (
"flag"
"os"
"github.com/foomo/petze/service"
"github.com/foomo/petze/config"
log "github.com/sirupsen/logrus"
)
var flagJsonOutput bool
func main() {
flag.Usage = usage
flag.BoolVar(&flagJsonOutput, "json-output", false, "specifies if the logging format is json or not")
flag.Parse()
... | Add --json-output flag (optional) to format standard output | Add --json-output flag (optional) to format standard output
| Go | mit | foomo/petze |
a20e4831122d1b8c1b1e944228d0ccc1e23a5b10 | pkg/api/store/service/service.go | pkg/api/store/service/service.go | package service
import (
"strconv"
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/convert"
v3 "github.com/rancher/types/client/project/v3"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/intstr"
)
func New(store types.Store) types.Store {
return &Store{
store,
}
}
type Store... | package service
import (
"strconv"
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/convert"
v3 "github.com/rancher/types/client/project/v3"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/intstr"
)
func New(store types.Store) types.Store {
return &Store{
store,
}
}
type Store... | Update now that ints aren't nullable | Update now that ints aren't nullable
| Go | apache-2.0 | rancher/rancher,rancherio/rancher,rancherio/rancher,cjellick/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,cjellick/rancher,rancher/rancher |
3476e8384df372f4da52951aef0bc363cc6669b1 | utils.go | utils.go | package sysinfo
import (
"errors"
"io/ioutil"
"strings"
)
var (
ErrUserNotFound = errors.New("user not found")
ErrGroupNotFound = errors.New("group not found")
ErrInvalidFileFormat = errors.New("invalid file format")
)
func readSingleValueFile(path string) (string, error) {
content, err := ioutil.Rea... | package sysinfo
import (
"errors"
"io/ioutil"
"strings"
)
// #include <unistd.h>
import "C"
var (
TicksPerSecond uint64
ErrUserNotFound = errors.New("user not found")
ErrGroupNotFound = errors.New("group not found")
ErrInvalidFileFormat = errors.New("invalid file format")
)
func init() {
TicksPerS... | Add TicksPerSecond constant obtained from sysconf(_SC_CLK_TCK) call | Add TicksPerSecond constant obtained from sysconf(_SC_CLK_TCK) call
| Go | mit | adrg/sysinfo |
568c4907fb595dd062f2a06bcdc447a970f7f7ec | panic.go | panic.go | package handler
import (
"fmt"
"net/http"
"runtime/debug"
"time"
)
var PanicDateFormat = "Jan 2, 2006 at 3:04pm (MST)"
type PanicLogger interface {
Print(v ...interface{})
}
// Panic returns a handler that invokes the passed handler h, catching any
// panics. If one occurs, an HTTP 500 response is produced. If... | package handler
import (
"fmt"
"net/http"
"runtime/debug"
"time"
)
var PanicDateFormat = "Jan 2, 2006 at 3:04pm (MST)"
// PanicLogger is used to print out detailed messages when a panic occurs.
type PanicLogger interface {
Print(v ...interface{})
}
// Panic returns a handler that invokes the passed handler h, ... | Add a doc for the PanicLogger | Add a doc for the PanicLogger
| Go | mit | urandom/handler |
a11f1147c6936eaef4102a4b964aefd19058f44b | marvel_test.go | marvel_test.go | package marvel
import (
"flag"
"testing"
)
var (
apiKey = flag.String("pub", "", "Public API key")
secret = flag.String("priv", "", "Private API secret")
)
func TestRequest(t *testing.T) {
flag.Parse()
r, err := Client{
PublicKey: *apiKey,
PrivateKey: *secret,
}.SingleSeries(2258).Comics(ComicsParams{})... | package marvel
import (
"flag"
"testing"
)
var (
apiKey = flag.String("pub", "", "Public API key")
secret = flag.String("priv", "", "Private API secret")
)
func TestRequest(t *testing.T) {
flag.Parse()
c := Client{
PublicKey: *apiKey,
PrivateKey: *secret,
}
r, err := c.SingleSeries(2258).Comics(ComicsP... | Add test case for getting single entity | Add test case for getting single entity
| Go | apache-2.0 | ImJasonH/go-marvel |
237d4b28366a596fc0f325289cae37a9f6f48aca | xurls.go | xurls.go | /* Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc> */
/* See LICENSE for licensing information */
package main
import (
"bufio"
"fmt"
"os"
"regexp"
)
var regexLink = regexp.MustCompile(
`([^\s'"<>\(\)]+:(//)?|(http|ftp|www)[^.]*\.)[^\s'"<>\(\)]*[^\s.,;:'"<>\(\)]`)
func main() {
scanner := bufio.NewScanner(o... | /* Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc> */
/* See LICENSE for licensing information */
package main
import (
"bufio"
"fmt"
"os"
"regexp"
)
var regexLink = regexp.MustCompile(
`(([^\s'"<>\(\)]+:(//)?|(http|ftp|www)[^.]*\.)[^\s'"<>\(\)]*|[^\s'"<>\(\)]+\.(com|org|net|edu|info)(/[^\s'"<>\(\)]*)?)[^.,;:... | Add support for the main TLDs | Add support for the main TLDs
| Go | bsd-3-clause | mvdan/xurls,digideskio/xurls |
247316c8e57992bf871300fcb2e44dabb2d2f237 | example/client/client.go | example/client/client.go | package main
import (
"fmt"
"github.com/nightexcessive/websocket"
)
func testMessage(socket *websocket.WebSocket, message string) {
if err := socket.SendString("Hello, World!"); err != nil {
panic(fmt.Sprintf("Error when sending: %s\n", err))
return
}
fmt.Printf("Message sent: %q\n", message)
messageEvent... | package main
import (
"fmt"
"github.com/gopherjs/websocket"
)
func testMessage(socket *websocket.WebSocket, message string) {
if err := socket.SendString("Hello, World!"); err != nil {
panic(fmt.Sprintf("Error when sending: %s\n", err))
return
}
fmt.Printf("Message sent: %q\n", message)
messageEvent, erro... | Change example import to GopherJS version | Change example import to GopherJS version
| Go | bsd-3-clause | gopherjs/websocket,gopherjs/websocket,gopherjs/websocket |
0c10e8b324e0d06b2e583d0744db0febcef0f321 | aligner.go | aligner.go | package alita
import (
"bufio"
"fmt"
"io"
"strings"
)
type Aligner struct {
w io.Writer
Margin *Margin
Delimiter *Delimiter
Padding *Padding
lines [][]string
}
func NewAligner(w io.Writer) *Aligner {
return &Aligner{
w: w,
Margin: NewMargin(),
Delimiter: NewDelimiter(),
... | package alita
import (
"bufio"
"fmt"
"io"
"strings"
)
type Aligner struct {
w io.Writer
Margin *Margin
Delimiter *Delimiter
Padding *Padding
lines [][]string
}
func NewAligner(w io.Writer) *Aligner {
return &Aligner{
w: w,
Margin: NewMargin(),
Delimiter: NewDelimiter(),
... | Split too long funcall chain | Split too long funcall chain
| Go | mit | kusabashira/alita |
3f0017b58f23e2d8376de07c0bfd62d679f53e1b | jvmgo/options/options.go | jvmgo/options/options.go | package options
import (
"os"
"path/filepath"
)
var (
VerboseClass bool
ThreadStackSize uint
AbsJavaHome string // /path/to/jre
AbsJreLib string // /path/to/jre/lib
)
func InitOptions(verboseClass bool, xss int, useJavaHome bool) {
VerboseClass = verboseClass
ThreadStackSize = uint(xss)
initJav... | package options
import (
"os"
"path/filepath"
"strings"
)
var (
VerboseClass bool
ThreadStackSize uint
AbsJavaHome string // /path/to/jre
AbsJreLib string // /path/to/jre/lib
)
func InitOptions(verboseClass bool, xss int, useJavaHome bool) {
VerboseClass = verboseClass
ThreadStackSize = uint(xs... | Support both jre and jdk path for -XuseJavaHome | Support both jre and jdk path for -XuseJavaHome
| Go | mit | zxh0/jvm.go,zxh0/jvm.go,zxh0/jvm.go |
a9a177733220f910f35c306852332f73c810336e | helpers/agouti_driver.go | helpers/agouti_driver.go | package helpers
import "github.com/sclevine/agouti"
func AgoutiDriver() *agouti.WebDriver {
return agouti.PhantomJS()
}
| package helpers
import (
"fmt"
"os"
"os/exec"
"github.com/onsi/ginkgo"
"github.com/sclevine/agouti"
)
func AgoutiDriver() *agouti.WebDriver {
if _, err := exec.LookPath("phantomjs"); err == nil && os.Getenv("FORCE_SELENIUM") != "true" {
fmt.Fprintln(ginkgo.GinkgoWriter, "WARNING: using phantomjs, which is fl... | Revert "never use selenium ever" | Revert "never use selenium ever"
This reverts commit 2b17348c5eb516d3d5b340c8fd28cc065594d42a.
| Go | apache-2.0 | concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse |
0e3de8615db8251e2fd1c197e80d17ff74c8ceb1 | pkg/containers/docker.go | pkg/containers/docker.go | package containers
import (
"github.com/fsouza/go-dockerclient"
)
type DockerRuntime struct {
Client *docker.Client
}
func isRelated(volume string, container *docker.Container) bool {
for _, mount := range container.Mounts {
if mount.Name == volume && mount.Driver == "dvol" {
return true
}
}
return false... | package containers
import (
"github.com/fsouza/go-dockerclient"
)
type DockerRuntime struct {
Client *docker.Client
}
func isRelated(volume string, container *docker.Container) bool {
for _, mount := range container.Mounts {
if mount.Name == volume && mount.Driver == "dvol" {
return true
}
}
return false... | Add a docstring for Related. | Add a docstring for Related.
| Go | apache-2.0 | ClusterHQ/dvol,ClusterHQ/dvol,ClusterHQ/dvol |
0f5bbb3e9e0aaa28e6a6ac27fbf00de02b14041b | aggregate/aggregate.go | aggregate/aggregate.go | package aggregate
import (
"github.com/loadimpact/speedboat/runner"
)
func Aggregate(stats *Stats, in <-chan runner.Result) <-chan runner.Result {
ch := make(chan runner.Result)
go func() {
defer close(ch)
defer stats.End()
for res := range in {
if res.Abort {
continue
}
stats.Ingest(&res)
... | package aggregate
import (
"github.com/loadimpact/speedboat/runner"
)
func Aggregate(stats *Stats, in <-chan runner.Result) <-chan runner.Result {
ch := make(chan runner.Result)
go func() {
defer close(ch)
defer stats.End()
for res := range in {
if !res.Abort {
stats.Ingest(&res)
}
ch <- res
... | Abort results weren't forwarded properly | [fix] Abort results weren't forwarded properly
| Go | agpl-3.0 | StephenRadachy/k6,gbts/k6,loadimpact/k6,StephenRadachy/k6,gbts/k6,loadimpact/k6,gbts/k6,gbts/k6 |
42d1c52c12fbabf4cfe5cb795e43642c8c925861 | libvirt_schema/schema.go | libvirt_schema/schema.go | // Copyright 2017 Kumina, https://kumina.nl/
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... | // Copyright 2017 Kumina, https://kumina.nl/
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... | Remove field from the XML that we don't use. | Remove field from the XML that we don't use.
| Go | apache-2.0 | mvtks/nova_exporter,mvtks/nova_exporter,kumina/libvirt_exporter,kumina/libvirt_exporter |
4e245096a70f2731d03cb79fb9942d062df9e81e | models/issue/vector.go | models/issue/vector.go | package issue
import "net/http"
type HttpBody struct {
ContentEncoding string `json:"contentEncoding"`
Content []byte `json:"content"`
}
type HttpEntity struct {
Status string `json:"status"`
Header http.Header `json:"header"`
Body *HttpBody `json:"body,omitempty"`
}
type HttpTransaction struc... | package issue
import "net/http"
type HttpBody struct {
ContentEncoding string `json:"contentEncoding"`
Content []byte `json:"content,string"`
}
type HttpEntity struct {
Status string `json:"status"`
Header http.Header `json:"header"`
Body *HttpBody `json:"body,omitempty"`
}
type HttpTransactio... | Set Content type to string for swagger | Set Content type to string for swagger
| Go | mit | cyberintruder/bearded,bearded-web/bearded,jack51706/bearded,cyberintruder/bearded,jack51706/bearded,cyberintruder/bearded,bearded-web/bearded,jack51706/bearded,cyberintruder/bearded,jack51706/bearded,bearded-web/bearded,bearded-web/bearded |
d7a3abab20e990b11d3000e4c57cf28dc649aba2 | pdf/characters_test.go | pdf/characters_test.go | package pdf
import "testing"
// Unit tests follow
func TestIsWhite (t *testing.T) {
for _,b := range []byte("\000\t\n\f\r ") {
if (!IsWhiteSpace (b)) {
t.Errorf ("IsWhiteSpace('\\%.3o') failed", b)
}
}
}
func TestIsDelimiter (t *testing.T) {
for _,b := range []byte("%()/<>[]{}") {
if (!IsDelimiter (b)) ... | package pdf
import "testing"
import "strings"
// Unit tests follow
func removeIf (f func (b byte) bool, s string) string {
return strings.Map (
func (r rune) rune {
if f(byte(r)) {
return r
}
return -1
},
s)
}
func TestAlt (t *testing.T) {
arrayOfAllLatin1Runes := make([]rune, 256, 256)
for i... | Simplify unit tests for character-set predicates. | Simplify unit tests for character-set predicates.
| Go | apache-2.0 | mawicks/PDFiG |
5055dad156db126036f5456bdb5800fca2782403 | general/routing/contentTypes.go | general/routing/contentTypes.go | // Package routing contains various functions related to HTTP routing
package routing
import (
"errors"
"strings"
)
// getContentType returns the http header safe content-type attribute for the
// requested path. If the requested path is not formatted correctly with an extension
// then the function will return the... | // Package routing contains various functions related to HTTP routing
package routing
import (
"errors"
"path/filepath"
)
// getContentType returns the http header safe content-type attribute for the
// requested path. If the requested path is not formatted correctly with an extension
// then the function will retu... | Use filepath/Ext in case a user decides to name a file with multiple . | Use filepath/Ext in case a user decides to name a file with multiple .
| Go | mit | Ennovar/gPanel,george-e-shaw-iv/gPanel,george-e-shaw-iv/gPanel,Ennovar/gPanel,george-e-shaw-iv/gPanel,Ennovar/gPanel |
ce69aa183e6178d35f3a6343c5de252011f578fa | stringset.go | stringset.go | package stringset
type StringSet struct {
strMap map[string]bool
}
func New(elements ...string) *StringSet {
s := &StringSet{}
s.Clear()
for _, el := range elements {
s.Add(el)
}
return s
}
func (s *StringSet) Len() int {
return len(s.strMap)
}
func (s *StringSet) Add(str string) {
s.strMap[str] = true
}
fu... | package stringset
type StringSet struct {
strMap map[string]bool
}
func New(elements ...string) *StringSet {
s := &StringSet{}
s.Clear()
for _, el := range elements {
s.Add(el)
}
return s
}
func (s *StringSet) Len() int {
return len(s.strMap)
}
func (s *StringSet) Add(str string) bool {
if _, exists := s.st... | Add return value to Add function indicating whether key was added or was already present | Add return value to Add function indicating whether key was added or was already present
| Go | isc | tillberg/stringset |
e2c04cc6f52c9e97ae01e2d4540fa0450f24d16c | api/sftp_endpoints.go | api/sftp_endpoints.go | package api
import (
"encoding/json"
"github.com/pkg/errors"
"github.com/pterodactyl/sftp-server"
)
func (r *PanelRequest) ValidateSftpCredentials(request sftp_server.AuthenticationRequest) (*sftp_server.AuthenticationResponse, error) {
b, err := json.Marshal(request)
if err != nil {
return nil, err
}
resp,... | package api
import (
"encoding/json"
"github.com/pkg/errors"
"github.com/pterodactyl/sftp-server"
)
func (r *PanelRequest) ValidateSftpCredentials(request sftp_server.AuthenticationRequest) (*sftp_server.AuthenticationResponse, error) {
b, err := json.Marshal(request)
if err != nil {
return nil, err
}
resp,... | Change endpoint for SFTP credentials | Change endpoint for SFTP credentials
| Go | mit | Pterodactyl/wings,Pterodactyl/wings |
268d09ff39fa04f26fae04f688eb935b1962db5e | apps/sniff.go | apps/sniff.go | package main
import (
"log"
"os"
"os/signal"
"github.com/ecc1/medtronic"
)
const (
verbose = false
)
var (
signalChan = make(chan os.Signal, 1)
)
func main() {
pump, err := medtronic.Open()
if err != nil {
log.Fatal(err)
}
signal.Notify(signalChan, os.Interrupt)
go catchInterrupt(pump)
log.SetFlags... | package main
import (
"log"
"os"
"os/signal"
"github.com/ecc1/medtronic"
)
const (
verbose = true
)
var (
signalChan = make(chan os.Signal, 1)
)
func main() {
if verbose {
log.SetFlags(log.Ltime | log.Lmicroseconds | log.LUTC)
}
pump, err := medtronic.Open()
if err != nil {
log.Fatal(err)
}
signal... | Use high-resolution timestamps in verbose mode only | Use high-resolution timestamps in verbose mode only
| Go | mit | ecc1/medtronic,ecc1/medtronic |
9d6356225769a093a90601efec3edc649dc4b04b | fdset_64.go | fdset_64.go | // +build amd64,arm64,!darwin,!netbsd,!openbsd
package goselect
// darwin, netbsd and openbsd uses uint32 on both amd64 and 386
const (
// NFDBITS is the amount of bits per mask
NFDBITS = 8 * 8
)
| // +build amd64,arm64 !darwin,!netbsd,!openbsd
package goselect
// darwin, netbsd and openbsd uses uint32 on both amd64 and 386
const (
// NFDBITS is the amount of bits per mask
NFDBITS = 8 * 8
)
| Fix issue in build tags | Fix issue in build tags
Signed-off-by: Guillaume J. Charmes <3bff908c20164893068523f78964055710b2c265@leaf.ag>
| Go | mit | creack/goselect,creack/goselect |
49f230e4f80c5c59e4019805cf7c3e58cc9b2b0e | install.go | install.go | package main
import (
"errors"
"fmt"
"log"
"os/exec"
)
// Iterates over Godep file dependencies and sets
// the specified version on each of them.
func install() error {
deps, err := readDepFile()
if err != nil {
return err
}
_, err = exec.LookPath("go")
if err != nil {
return errors.New("Go is currentl... | package main
import (
"errors"
"fmt"
"log"
"os/exec"
"github.com/mtibben/gogpm/vcs"
)
// Iterates over Godep file dependencies and sets
// the specified version on each of them.
func install() error {
deps, err := readDepFile()
if err != nil {
return err
}
_, err = exec.LookPath("go")
if err != nil {
... | Check if go get should upate | Check if go get should upate
| Go | bsd-3-clause | mtibben/gogpm |
e9d939ff2d11c7da123bc2d20bb9f096b5482124 | src/restic/node_xattr.go | src/restic/node_xattr.go | // +build !openbsd
// +build !windows
package restic
import (
"restic/errors"
"syscall"
"github.com/pkg/xattr"
)
// Getxattr retrieves extended attribute data associated with path.
func Getxattr(path, name string) ([]byte, error) {
b, e := xattr.Getxattr(path, name)
if err, ok := e.(*xattr.XAttrError); ok && e... | // +build !openbsd
// +build !windows
package restic
import (
"restic/errors"
"syscall"
"github.com/pkg/xattr"
)
// Getxattr retrieves extended attribute data associated with path.
func Getxattr(path, name string) ([]byte, error) {
b, e := xattr.Get(path, name)
if err, ok := e.(*xattr.Error); ok && err.Err == ... | Update code for pkg/xattr v0.2.0 | Update code for pkg/xattr v0.2.0
| Go | bsd-2-clause | fawick/restic,kurin/restic,middelink/restic,middelink/restic,fawick/restic,jayme-github/restic,restic/restic,kurin/restic,ar-jan/restic,jayme-github/restic,restic/restic,ar-jan/restic |
3d657054638f89a72d55016b16637de71193247a | handlers.go | handlers.go | package core
import "net/http"
type handlersStack []func(*Context)
var handlers handlersStack
// Use adds a handler to the handlers stack.
func Use(h func(*Context)) {
handlers = append(handlers, h)
}
func (h handlersStack) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Init a new context for the request... | package core
import "net/http"
type handlersStack []func(*Context)
var handlers handlersStack
// Use adds a handler to the handlers stack.
func Use(h func(*Context)) {
handlers = append(handlers, h)
}
func (h handlersStack) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Init a new context for the request... | Use Vary header by default | Use Vary header by default
| Go | mit | volatile/core |
ded70ace33c11aa33c8c565cbf852b0b31afa055 | commands.go | commands.go | package main
import (
"log"
"os"
"github.com/timakin/ts/loader"
"github.com/codegangsta/cli"
)
var Commands = []cli.Command{
commandAll,
commandBiz,
commandHack,
}
var commandAll = cli.Command{
Name: "all",
Usage: "",
Description: `
`,
Action: doAll,
}
var commandBiz = cli.Command{
Name: "biz",
Usage... | package main
import (
"log"
"os"
"github.com/timakin/ts/loader"
"github.com/codegangsta/cli"
)
var Commands = []cli.Command{
commandAll,
commandBiz,
commandHack,
}
var commandAll = cli.Command{
Name: "all",
Usage: "",
Description: `
`,
Action: doAll,
}
var commandBiz = cli.Command{
Name: "biz",
Usage... | Change arguement of feed name | Change arguement of feed name
| Go | mit | timakin/ts,timakin/ts |
e3b88f49581c3e387f016a6d305f27cd72b2fcc1 | cmd/commands_status.go | cmd/commands_status.go | // BaruwaAPI Golang bindings for Baruwa REST API
// Copyright (C) 2019 Andrew Colin Kissa <andrew@topdog.za.net>
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
// ... | // BaruwaAPI Golang bindings for Baruwa REST API
// Copyright (C) 2019 Andrew Colin Kissa <andrew@topdog.za.net>
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
// ... | Add system status cmdline implementation | FET: Add system status cmdline implementation
| Go | mpl-2.0 | akissa/baruwa-go |
090a30e98830f1168f88549cce394d672130e5b1 | builtin/providers/consul/config.go | builtin/providers/consul/config.go | package consul
import (
"log"
consulapi "github.com/hashicorp/consul/api"
)
type Config struct {
Datacenter string `mapstructure:"datacenter"`
Address string `mapstructure:"address"`
}
// Client() returns a new client for accessing digital
// ocean.
//
func (c *Config) Client() (*consulapi.Client, error) {
... | package consul
import (
"log"
consulapi "github.com/hashicorp/consul/api"
)
type Config struct {
Datacenter string `mapstructure:"datacenter"`
Address string `mapstructure:"address"`
}
// Client() returns a new client for accessing consul.
//
func (c *Config) Client() (*consulapi.Client, error) {
config := ... | Fix comment in consul provider to not mention digitalocean | Fix comment in consul provider to not mention digitalocean | Go | mpl-2.0 | HotelsDotCom/terraform,thegedge/terraform,randomvariable/terraform,grubernaut/terraform,DevoKun/terraform,stayup-io/terraform,harijayms/terraform,nathanielks/terraform,KensoDev/terraform,srikalyan/terraform,dalehamel/terraform,magnumopus/terraform,ryansroberts/terraform,codeinthehole/terraform,carinadigital/terraform,c... |
4fe96cf69b5936619f2d82a7a53bdb3d327b29b6 | config/config_windows.go | config/config_windows.go | package config
// The default configuration for windows
var DefaultConfig = &Config{
Apibase: "https://mackerel.io",
Root: ".",
Pidfile: "mackerel-agent.pid",
Conffile: "mackerel-agent.conf",
Roles: []string{},
Verbose: false,
Connection: ConnectionConfig{
PostMetricsDequeueDelaySeconds: 30,
PostM... | package config
import (
"log"
"path/filepath"
"syscall"
"unsafe"
)
func execdirInit() string {
var (
kernel32 = syscall.NewLazyDLL("kernel32")
procGetModuleFileName = kernel32.NewProc("GetModuleFileNameW")
)
var wpath [syscall.MAX_PATH]uint16
r1, _, err := procGetModuleFileName.Call(0, uintpt... | Change DefaultConfig pathes on windows | Change DefaultConfig pathes on windows
| Go | apache-2.0 | kamatama41/mackerel-agent,yyljlyy/mackerel-agent,kamatama41/mackerel-agent,kamatama41/mackerel-agent,stanaka/mackerel-agent,stanaka/mackerel-agent,mackerelio/mackerel-agent,stanaka/mackerel-agent,yyljlyy/mackerel-agent,mackerelio/mackerel-agent,moznion/mackerel-agent,yyljlyy/mackerel-agent,yyljlyy/mackerel-agent,moznio... |
61432cd257371a28175c8928deee4588924b0d52 | builder/oracle/oci/step_instance_info.go | builder/oracle/oci/step_instance_info.go | package oci
import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type stepInstanceInfo struct{}
func (s *stepInstanceInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
var (
driver = state.Get("driver").(Driver)
ui = s... | package oci
import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type stepInstanceInfo struct{}
func (s *stepInstanceInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
var (
driver = state.Get("driver").(Driver)
ui = s... | Update logs to talk about IP instead of public IP | Update logs to talk about IP instead of public IP
When logging we don't know whether we use a private or public ip, just
the ip itself.
| Go | mpl-2.0 | KohlsTechnology/packer,hashicorp/packer,KohlsTechnology/packer,dave2/packer,tb3088/packer,tas50/packer,ricardclau/packer,timsutton/packer,bryson/packer,ChrisLundquist/packer,ricardclau/packer,youhong316/packer,paulmey/packer,paulmey/packer,bryson/packer,mitchellh/packer,youhong316/packer,rnaveiras/packer,tas50/packer,C... |
25aeea9bf2a9198837ba5f4a8692168f302f86ed | cmd/issuechk/issuechk.go | cmd/issuechk/issuechk.go | package main
import (
"fmt"
"github.com/google/go-github/github"
)
func main() {
client := github.NewClient(nil)
for i := 0; i < 100; i++ {
issue, _, err := client.Issues.Get("go-swagger", "go-swagger", i)
if err != nil {
fmt.Errorf("Issues.Get returned error: %v", err)
} else {
fmt.Println(*issue.Nu... | /*
# Issue Checker
Scans your source code for issue links and prints there statuses.
## License
```
The MIT License (MIT)
Copyright (c) 2015 Evecon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softw... | Add licence to source file | Add licence to source file
| Go | mit | evecon/issuechk,evecon/issuechk |
f4a00633ae215b8bcdb5554b7469db925d47a473 | cli/FlagMap.go | cli/FlagMap.go | package cli
import "sort"
// flagMap is a map of flags with the name as a string key
type flagMap map[string]*Flag
func (fm flagMap) Merge(fm2 flagMap) flagMap {
for k, v := range fm2 {
fm[k] = v
}
return fm
}
func (fm flagMap) Names() []string {
var keys []string
for k := range fm {
keys = append(keys, k)... | package cli
import "sort"
// flagMap is a map of flags with the name as a string key
type flagMap map[string]*Flag
func (fm flagMap) Merge(fm2 flagMap) flagMap {
mergedMap := make(flagMap)
if fm != nil {
for k, v := range fm {
mergedMap[k] = v
}
}
if fm2 != nil {
for k, v := range fm2 {
mergedMap[k] ... | Add Merge and Without methods | Add Merge and Without methods
| Go | mit | jwaldrip/odin |
3f7cf73acc9c50675d04443a97012a2131e465ce | controller/controller.go | controller/controller.go | package controller
import (
"fmt"
"net/http"
"github.com/rs/xid"
)
// RequestID is the unique Request ID for each request
type TraceID struct {
xid.ID
}
// StandardResponseFields is meant to be included in all response bodies
// and includes "standard" response fields
type StandardResponseFields struct {
Path ... | package controller
import (
"fmt"
"net/http"
"github.com/rs/xid"
)
// RequestID is the unique Request ID for each request
type TraceID struct {
xid.ID
}
// StandardResponseFields is meant to be included in all response bodies
// and includes "standard" response fields
type StandardResponseFields struct {
Path ... | Make TraceID a string in response, so it can be truly omitted | Make TraceID a string in response, so it can be truly omitted
| Go | mit | gilcrest/go-API-template,gilcrest/go-API-template |
fd730cdde2df3bb3c97bdb1f7cc809a3d8672c6e | cmd/main.go | cmd/main.go | // Copyright © 2017 shoarai
// The renfls renames files in a directory.
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"strings"
"github.com/shoarai/renfls"
)
const toDir = "toSubDirsName"
// Flag
var ext string
var ignore bool
func main() {
// DEBUG:
// createTestDir()
flag.BoolVar(&ignore, "ignore"... | // Copyright © 2017 shoarai
// The renfls renames files in a directory.
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"strings"
"github.com/shoarai/renfls"
)
const toDir = "toSubDirsName"
// Flag
var ext string
var ignore bool
func main() {
// DEBUG:
// createTestDir()
flag.BoolVar(&ignore, "ignore"... | Fix comment for extensions flag | Fix comment for extensions flag
| Go | mit | shoarai/renfls |
36687dcd97cae1002ff58c457aa054ce00cd7578 | dotignore/dotignore.go | dotignore/dotignore.go | package dotignore
import (
"bufio"
"os"
"path/filepath"
"strings"
"sync"
"github.com/drpotato/dotdot/filesystem"
)
var ignoredFiles map[string]bool
var once sync.Once
func ShouldIgnore(uri string) bool {
GetIgnoredFiles()
dotDirURI := filesystem.GetDotDirURI()
_, fileName := filepath.Split(uri)
return... | package dotignore
import (
"bufio"
"os"
"path/filepath"
"strings"
"sync"
"github.com/drpotato/dotdot/filesystem"
)
var ignoredFiles map[string]bool
var once sync.Once
func ShouldIgnore(uri string) bool {
GetIgnoredFiles()
dotDirURI := filesystem.GetDotDirURI()
_, fileName := filepath.Split(uri)
return... | Add .git as default ignored file/dir | Add .git as default ignored file/dir
| Go | mit | drpotato/dotdot |
25892d27be5dd10dac694fd4d5ae317882c32fc1 | required.go | required.go | package cli
import (
"fmt"
"github.com/spf13/cobra"
)
// MinRequiredArgs checks if the minimum number of args exists, and returns an
// error if they do not.
func MinRequiredArgs(args []string, min int, cmd *cobra.Command) error {
if len(args) >= min {
return nil
}
return fmt.Errorf(
"\"%s\" requires at le... | package cli
import (
"fmt"
"strings"
"github.com/spf13/cobra"
)
// NoArgs validate args and returns an error if there are any args
func NoArgs(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return nil
}
if cmd.HasSubCommands() {
return fmt.Errorf("\n" + strings.TrimRight(cmd.UsageString(),... | Use Args in cobra.Command to validate args. | Use Args in cobra.Command to validate args.
Also re-use context.
Signed-off-by: Daniel Nephin <6347c07ae509164cffebfb1e2a0d6ed64958db19@docker.com>
| Go | apache-2.0 | thaJeztah/cli,thaJeztah/cli,gdevillele/cli,dnephin/cli,docker/cli,cpuguy83/cli,ashfall/cli,Zebrilee/cli,Zebrilee/cli,riyazdf/cli,ashfall/cli,dnephin/cli,e11137/cli,redpanda/cli,allencloud/cli,e11137/cli,riyazdf/cli,cpuguy83/cli,allencloud/cli,redpanda/cli,docker/cli |
78e5696ce8e138ac98c315a71a4e45f63115558c | package-coverage/parser/line_parser.go | package-coverage/parser/line_parser.go | package parser
import (
"fmt"
"strconv"
"strings"
)
type fragment struct {
pkg string
statements int
covered bool
}
func parseLine(raw string) fragment {
output := fragment{
pkg: extractPackage(raw),
}
output.statements, output.covered = extractNumbers(raw)
return output
}
func extractPackag... | package parser
import (
"fmt"
"strconv"
"strings"
)
type fragment struct {
pkg string
statements int
covered bool
}
func parseLine(raw string) fragment {
output := fragment{
pkg: extractPackage(raw),
}
output.statements, output.covered = extractNumbers(raw)
return output
}
func extractPackag... | Fix support for the `-covermode=count` and `covermode=atomic` options | Fix support for the `-covermode=count` and `covermode=atomic` options
| Go | apache-2.0 | corsc/go-tools |
66fcc5495de6effca67dc5ab0d55e2056470c3f4 | integration-tests/processgroup_others.go | integration-tests/processgroup_others.go | //+build !windows
package main
func SetupProcessGroup() error {
// nothing to do on other platforms
}
| //+build !windows
package main
func SetupProcessGroup() error {
// nothing to do on non-windows platforms
return nil
}
| Fix build for non-windows platforms | Fix build for non-windows platforms
| Go | mit | itchio/itch,itchio/itch,itchio/itch,itchio/itchio-app,itchio/itch,leafo/itchio-app,itchio/itch,itchio/itchio-app,leafo/itchio-app,itchio/itch,leafo/itchio-app,itchio/itchio-app |
53083a0be1fd640642c5af472edd04aa4b11c5bd | lib/flak/assist.go | lib/flak/assist.go | package flak
import (
"os"
"path/filepath"
"github.com/spacemonkeygo/errors"
"github.com/spacemonkeygo/errors/try"
)
// Runs a function with a tempdir, cleaning up afterward.
func WithDir(f func(string), dirs ...string) {
if len(dirs) < 1 {
panic(errors.ProgrammerError.New("Must have at least one sub-folder ... | package flak
import (
"os"
"path/filepath"
"github.com/spacemonkeygo/errors"
)
/*
Creates a directory, calls the given function, and removes the dir again afterward.
The created path is handed to the given function (cwd is untouched).
Multiple parent dirs will be created if necessary. These will not be
remo... | Clean up more gingerly on errors. | Clean up more gingerly on errors.
As a code quality thing in general, unbounded cleanups on error paths are a bad idea. With filesystems that are being tied in pretzel knots, sextuply so.
A more ideal form of this in the future might do some checking for crossing over mount lines, and abort if found, but I'm not act... | Go | apache-2.0 | polydawn/repeatr,subuser-security/repeatr,subuser-security/repeatr,polydawn/repeatr |
9045ed8c512d1039716bb8678a514f0ff326db4c | cef.go | cef.go | package main
import (
"flag"
"golang.org/x/crypto/ssh/terminal"
"os"
)
func main() {
if terminal.IsTerminal(int(os.Stdin.Fd())) {
println("Cellophane v0.1 (C) 2015 Sten Linnarsson <http://linnarssonlab.org/>")
println()
}
// Define command-line flags
var flHelp = flag.Bool("help", false, "Show this help m... | package main
import (
"gopkg.in/alecthomas/kingpin.v1"
"os"
)
func main() {
// Define the command-line structure using Kingpin
var app = kingpin.New("cef", "Cellophane v0.1 (C) 2015 Sten Linnarsson <http://linnarssonlab.org/>")
var app_input = app.Flag("input", "Name of file to use as input (default: use STDIN)"... | Use kingpin for arg parsing | Use kingpin for arg parsing
| Go | bsd-2-clause | linnarsson-lab/ceftools |
e0a0a1014764145b68e0191f2588886a22f40aaf | test/integration/setup_integration_test.go | test/integration/setup_integration_test.go | package main
import (
"fmt"
"os"
"runtime/debug"
"testing"
. "github.com/onsi/gomega"
"github.com/sclevine/agouti"
)
const (
PORT = 9009
)
var (
baseUrl = fmt.Sprintf("http://localhost:%v/admin", PORT)
driver *agouti.WebDriver
page *agouti.Page
)
func TestMain(m *testing.M) {
var t *testing.T
var ... | package main
import (
"fmt"
"os"
"runtime/debug"
"testing"
. "github.com/onsi/gomega"
"github.com/sclevine/agouti"
)
const (
PORT = 4444
)
var (
baseUrl = fmt.Sprintf("http://localhost:%v/admin", PORT)
driver *agouti.WebDriver
page *agouti.Page
)
func TestMain(m *testing.M) {
var t *testing.T
var ... | Update default test server port to selenium default port to test browser on CI. | Update default test server port to selenium default port to test browser on CI. | Go | mit | youprofit/qor,amirrpp/qor,qor/qor,shidao-fm/qor,gavinzhs/qor,codedogfish/qor,codedogfish/qor,shidao-fm/qor,trigrass2/qor,codevlabs/qor,codevlabs/qor,insionng/qor,gavinzhs/qor,strogo/qor,strogo/qor,jmptrader/qor,yanzay/qor,youprofit/qor,lance2088/qor,yanzay/qor,jmptrader/qor,amirrpp/qor,shaunstanislaus/qor,insionng/qor,... |
bcd7c4daca17f42756441eb65868e9fabc74cbd7 | heaps/sortk.go | heaps/sortk.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 heaps
// reverseInts reverse elements of an[i:j] in an.
func reverseInts(an []int, i, j int) {
for i < j {
an[i], an[j] = an[j], an[i]
i++
... | // 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 heaps
// reverseInts reverse elements of an[i:j] in an.
func reverseInts(an []int, i, j int) {
for i < j {
an[i], an[j] = an[j], an[i]
i++
... | Fix comment and improve readability | Fix comment and improve readability
| Go | mit | mrekucci/epi,mrekucci/epi |
e3ff85aebc64241dce782336c000242d641803b3 | log_action.go | log_action.go | package bootstrap
import (
"fmt"
)
type LogAction struct {
Output string `json:"output"`
}
func init() {
Register("log", &LogAction{})
}
func (a *LogAction) Run(s *State) error {
fmt.Println(interpolate(s, a.Output))
return nil
}
| package bootstrap
type LogAction struct {
ID string `json:"id"`
Output string `json:"output"`
}
type LogMessage struct {
Msg string `json:"message"`
}
func (l *LogMessage) String() string {
return l.Msg
}
func init() {
Register("log", &LogAction{})
}
func (a *LogAction) Run(s *State) error {
s.StepData[a... | Modify log action so JSON output is consistent | bootstrap: Modify log action so JSON output is consistent
Without this, the output stream includes non-JSON text when running with
--json=true
Signed-off-by: Lewis Marshall <748e1641a368164906d4a0c0e3965345453dcc93@lmars.net>
| Go | bsd-3-clause | mubassirhayat/flynn,clifff/flynn,GrimDerp/flynn,Brandywine2161/flynn,TribeMedia/flynn,rikur/flynn,lmars/flynn,felixrieseberg/flynn,rikur/flynn,technosophos/flynn,rikur/flynn,felixrieseberg/flynn,TribeMedia/flynn,justintung/flynn,benbjohnson/flynn,Brandywine2161/flynn,whouses/flynn,TribeMedia/flynn,benbjohnson/flynn,ben... |
f1643bddfb247e1b03fd8bf29f67a16b14f8409b | pkg/apis/streaming/v1alpha1/types.go | pkg/apis/streaming/v1alpha1/types.go | package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type NatsStreamingClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []NatsStreamingCluster `json:"items"`
}
// +k... | package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type NatsStreamingClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []NatsStreamingCluster `json:"items"`
}
// +k... | Add size to NATS cluster spec | Add size to NATS cluster spec
Signed-off-by: Waldemar Quevedo <2d029dbd3aa3d2941d38f053a387cc1ce6eef7a1@synadia.com>
| Go | apache-2.0 | nats-io/nats-streaming-operator,nats-io/nats-streaming-operator |
20ceab72b2e2702d7b4883bf28d79c910d40464d | matrix_test.go | matrix_test.go | package matrix
import (
"testing"
)
func TestIdentity(t *testing.T) {
m := Identity(11)
rows, cols := m.Dim()
for i := 0; i < rows; i++ {
for k := 0; k < cols; k++ {
a := m.Get(i, k)
if i == k {
if a != 1 {
t.Fatalf("(%d, %d) == %f != 1", i, k, a)
}
} else {
if a != 0 {
t.Fatalf("... | package matrix
import (
"testing"
)
func TestIdentity(t *testing.T) {
m := Identity(11)
rows, cols := m.Dims()
for i := 0; i < rows; i++ {
for k := 0; k < cols; k++ {
a := m.Get(i, k)
if i == k {
if a != 1 {
t.Fatalf("(%d, %d) == %f != 1", i, k, a)
}
} else {
if a != 0 {
t.Fatalf(... | Fix compile error in TestIdentity(). | Fix compile error in TestIdentity().
| Go | bsd-3-clause | ziutek/matrix,ziutek/matrix |
abffd878585a8cbdea01b3bed40c9eaa5733a35f | service/openvpn/client/helper/executable_finder_darwin.go | service/openvpn/client/helper/executable_finder_darwin.go | package helper
var guessExecutableName = "openvpn"
var guessExecutablePaths = []string{
"/usr/local/sbin/openvpn",
"/Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.4.*-openssl-1.*/openvpn",
"/Applications/Shimo.app/Contents/MacOS/openvpn",
"/Applications/Viscosity.app/Contents/MacOS/openvpn",
}
... | package helper
var guessExecutableName = "openvpn"
var guessExecutablePaths = []string{
"/usr/local/sbin/openvpn",
"/usr/sbin/openvpn",
"/Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.4.*-openssl-1.*/openvpn",
"/Applications/Shimo.app/Contents/MacOS/openvpn",
"/Applications/Viscosity.ap... | Add /usr/sbin/openvpn to darwin path guesser | Add /usr/sbin/openvpn to darwin path guesser
Unix-based, so might as well have consistency with other OS's behavior.
Parity for 30a3de0b608a2696447ef942f2f08232f5c45365 | Go | mit | dpb587/ssoca,dpb587/ssoca,dpb587/ssoca |
f069298efdd00bce64897b2102d3a19c6477c4c9 | procfile.go | procfile.go | package main
import (
"bufio"
"os"
"regexp"
)
type procfileEntry struct {
Name string
Command string
Port int
}
func parseProcfile(path string, portBase, portStep int) (entries []procfileEntry) {
re, _ := regexp.Compile("^(\\w+):\\s+(.+)$")
f, err := os.Open(path)
fatalOnErr(err)
port := portBase
... | package main
import (
"bufio"
"os"
"regexp"
)
type procfileEntry struct {
Name string
Command string
Port int
}
func parseProcfile(path string, portBase, portStep int) (entries []procfileEntry) {
re, _ := regexp.Compile(`^([\w-]+):\s+(.+)$`)
f, err := os.Open(path)
fatalOnErr(err)
port := portBase
... | Allow `-` in process names | Allow `-` in process names
| Go | mit | DarthSim/hivemind,DarthSim/hivemind |
ba685f8f86f800126b6f7730343f6159b5325fc5 | command/command_test.go | command/command_test.go | package command
import (
"testing"
"github.com/hashicorp/vault/api"
)
func testClient(t *testing.T, addr string, token string) *api.Client {
config := api.DefaultConfig()
config.Address = addr
client, err := api.NewClient(config)
if err != nil {
t.Fatalf("err: %s", err)
}
client.SetToken(token)
return cl... | package command
import (
"testing"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/builtin/logical/pki"
"github.com/hashicorp/vault/builtin/logical/transit"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/vault"
vaulthttp "github.com/hashicorp/vault/http"
logxi "github.com/mgutz... | Add testing harness for a vault cluster | Add testing harness for a vault cluster
| Go | mpl-2.0 | hashicorp/vault,rnaveiras/vault,joelthompson/vault,hartsock/vault,kingland/vault,hashicorp/vault,rnaveiras/vault,quixoten/vault,hashicorp/vault,hartsock/vault,mgk/vault,hartsock/vault,kingland/vault,naunga/vault,Aloomaio/vault,rnaveiras/vault,hashicorp/vault,joelthompson/vault,rnaveiras/vault,Aloomaio/vault,mgk/vault,k... |
add5260561eef92dbba183921ed616120f178914 | havenapi/actions/registration_funnel.go | havenapi/actions/registration_funnel.go | package actions
import (
"fmt"
"github.com/deis/helm/log"
"github.com/gobuffalo/buffalo"
"github.com/gobuffalo/pop"
"github.com/kindlyops/mappamundi/havenapi/models"
)
// RegistrationHandler accepts json
func RegistrationHandler(c buffalo.Context) error {
tx := c.Value("tx").(*pop.Connection)
request := c.Req... | package actions
import (
"fmt"
"strings"
"github.com/deis/helm/log"
"github.com/gobuffalo/buffalo"
"github.com/gobuffalo/pop"
"github.com/kindlyops/mappamundi/havenapi/models"
)
// RegistrationHandler accepts json
func RegistrationHandler(c buffalo.Context) error {
tx := c.Value("tx").(*pop.Connection)
reque... | Refactor to use remote address from request. | Refactor to use remote address from request.
Now using the remote address from the go buffalo request
instead of accepting from the post.
Issue #HAV-133
Signed-off-by: Christopher Mundus <711c73f64afdce07b7e38039a96d2224209e9a6c@kindlyops.com>
| Go | apache-2.0 | kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi |
2f2e452896d9e0def81166d170cc73ab7171fba0 | raw_packet.go | raw_packet.go | package rtcp
// RawPacket represents an unparsed RTCP packet. It's returned by Unmarshal when
// a packet with an unknown type is encountered.
type RawPacket []byte
// Marshal encodes the packet in binary.
func (r RawPacket) Marshal() ([]byte, error) {
return r, nil
}
// Unmarshal decodes the packet from binary.
fu... | package rtcp
// RawPacket represents an unparsed RTCP packet. It's returned by Unmarshal when
// a packet with an unknown type is encountered.
type RawPacket []byte
// Marshal encodes the packet in binary.
func (r RawPacket) Marshal() ([]byte, error) {
return r, nil
}
// Unmarshal decodes the packet from binary.
fu... | Fix golint and misspell errors | Fix golint and misspell errors
Found by goreportcard
| Go | mit | pion/rtcp |
e56781078b52807576dfc598eb03765689e3849a | pkg/request/client.go | pkg/request/client.go | package request
import "net/http"
var DefaultClient = ClientImplementation{http.DefaultClient}
type Client interface {
Get(string, ...Parameter) (*Response, error)
}
type ClientImplementation struct {
HTTPClient *http.Client
}
func (c *ClientImplementation) performRequest(r *Request) (*Response, error) {
req :=... | package request
import (
"fmt"
"net/http"
"strings"
)
var DefaultClient = ClientImplementation{http.DefaultClient}
type Client interface {
Get(string, ...Parameter) (*Response, error)
}
type ClientImplementation struct {
HTTPClient *http.Client
}
func (c *ClientImplementation) performRequest(r *Request) (*Res... | Return more meaningful status code messages in request pkg | Return more meaningful status code messages in request pkg
| Go | apache-2.0 | tmrts/flamingo,tmrts/flamingo,maxamillion/flamingo,maxamillion/flamingo |
27d580afeaa56d1f4f615dff7a327e6dc80c8220 | server_handlers.go | server_handlers.go | package main
import (
"net/http"
"github.com/bigroom/communicator"
)
func defaultServerHandler(w http.ResponseWriter, r *http.Request) {
coms := communicator.New(w)
resp := struct {
Server string `json:"server"`
}{
Server: *defaultIRCServer,
}
coms.With(resp).
OK("Here is your thing!")
}
| package main
import (
"net/http"
"github.com/bigroom/communicator"
)
func defaultServerHandler(w http.ResponseWriter, r *http.Request) {
coms := communicator.New(w)
resp := struct {
Server string `json:"server"`
}{
Server: *defaultIRCServer,
}
coms.With(resp).
OK()
}
| Fix communicator to work with new API | Fix communicator to work with new API
| Go | mit | BigRoom/vision |
a958f4462dad05f73a736f83ccf7ecfff79f85c0 | pkg/issuer/acme/setup.go | pkg/issuer/acme/setup.go | package acme
import (
"fmt"
"github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager/v1alpha1"
)
func (a *Acme) Setup() (v1alpha1.IssuerStatus, error) {
updateStatus := a.issuer.Status.DeepCopy()
err := a.verifyAccount()
if err == nil {
updateStatus.Ready = true
return *updateStatus, nil
}
u... | package acme
import (
"fmt"
"github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager/v1alpha1"
)
const (
reasonAccountVerified = "ACME account verified"
reasonAccountRegistered = "ACME account registered"
reasonAccountRegistrationFailed = "ACME account registration failed"
message... | Switch to using Conditions for Issuer status | Switch to using Conditions for Issuer status
| Go | apache-2.0 | jetstack/cert-manager,cert-manager/cert-manager,cert-manager/cert-manager,jetstack/cert-manager,jetstack-experimental/cert-manager,jetstack-experimental/cert-manager,dippynark/cert-manager,dippynark/cert-manager,jetstack/cert-manager,cert-manager/cert-manager,jetstack-experimental/cert-manager,dippynark/cert-manager |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.