CombinedText stringlengths 4 3.42M |
|---|
package main
import (
"encoding/xml"
"flag"
"fmt"
"io/ioutil"
"math"
"net"
"net/http"
_ "net/http/pprof"
"strconv"
"strings"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
)
const (
namespace = "bind"
resolver = "resolver"
)
var (
up = prometheus.NewDesc(... |
// Copyright © 2016 Jip J. Dekker <jip@dekker.li>
//
// 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 ... |
package main
import (
"exp/draw/x11"
"exp/draw"
"image"
"fmt"
"math"
"rand"
"time"
"rog-go.googlecode.com/hg/canvas"
)
// to add:
// Rectangle.Eq()
// modifications for mac os X11
// should it crash if Draw is passed a non-canonical rectangle?
// it's a pity that image.RGBAColor isn't a draw.Color
type RectF... |
package broker
import (
"encoding/json"
"net/http"
"github.com/Sirupsen/logrus"
"github.com/nats-io/go-nats"
"github.com/pkg/errors"
"github.com/pborman/uuid"
"time"
"fmt"
)
type jsonError struct {
Message string `json:"message"`
}
type Broker struct {
Logger logrus.Logger
N *nats.Conn
Version st... |
// Package listener implements the listener pool and handlers for metrics.
package listener
import (
"bufio"
"net"
"os"
"strconv"
"strings"
"time"
"github.com/jeffpierce/cassabon/config"
"github.com/jeffpierce/cassabon/logging"
)
// CarbonMetric is the canonical representation of Carbon data.
type CarbonMetr... |
package docker
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
)
func TestBadRequest(t *testing.T) {
var tests = []struct {
err error
want string
}{
{
fmt.Errorf(`BadRequest`),
`BadRequest
`,
},
}
for _, test := range tests {
writer := httptest.NewRecorder()
badRequest(writer, test... |
// Copyright (c) 2013 Couchbase, Inc.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in w... |
package jsonhl
import (
"bytes"
"github.com/dawi/jsont"
"io"
"strings"
)
var resetColor = "\x1b[0m"
type Colors map[jsont.TokenType]string
var DefaultColors = Colors{
jsont.ObjectStart: "\x1b[38;5;242m",
jsont.ObjectEnd: "\x1b[38;5;242m",
jsont.ArrayStart: "\x1b[38;5;242m",
jsont.ArrayEnd: "\x1b[38;5;... |
/*
Copyright (c) 2017 Ross Oreto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, subl... |
// Copyright 2018 Adam Tauber
//
// 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... |
package http
import (
"bytes"
"crypto/md5"
"encoding/hex"
"encoding/json"
"github.com/astaxie/beego/orm"
"github.com/bitly/go-simplejson"
"github.com/Cepave/query/g"
"io"
"io/ioutil"
"log"
"net/http"
"strconv"
"time"
)
type Endpoint struct {
Id int
Endpoint string
Ts int64
T_create string... |
package toshl
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
)
// HTTPClient is an interface to define the client to access API resources
type HTTPClient interface {
Get(APIUrl, queryString string) (string, error)
Post(APIUrl, JSONPayload string) (string, error)
Update(API... |
/*** Copyright (c) 2016, University of Florida Research Foundation, Inc. ***
*** For more information please refer to the LICENSE.md file ***/
package gorods
// #include "wrapper.h"
import "C"
import (
"fmt"
"html/template"
"log"
"mime"
"net/http"
"path/filepath"
"strconv"
"strings"
)
func FileS... |
package sudoku
import (
"fmt"
"log"
"math"
"os"
"sync"
)
//The number of solves we should average the signals together for before asking them for their difficulty
//Note: this should be set to the num-solves parameter used to train the currently configured weights.
const _NUM_SOLVES_FOR_DIFFICULTY = 10
//The li... |
// Copyright 2015, David Howden
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tag
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"strings"
"unicode/utf16"
)
// DefaultUTF16WithBOMByteOrder is the byte order used when the "UTF16 with BOM" enco... |
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package ids
import (
"bytes"
"reflect"
"testing"
)
func TestID(t *testing.T) {
hash := [32]byte{24}
id := NewID(hash)
if key := id.Key(); !bytes.Equal(hash[:], key[:]) {
t.Fatalf("ID.Key returned wrong bytes")... |
// Copyright 2016 The Linux Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
// Copyright 2013 The Go-IMAP 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 imap
import (
"bytes"
"fmt"
"io"
"strconv"
)
// ParserError indicates a problem with the server response format. This could
// be the result ... |
// http://golang.org/src/pkg/crypto/tls/generate_cert.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package shared
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem... |
package main
import (
"errors"
"io/ioutil"
"net/http"
"runtime"
"strconv"
"strings"
"github.com/inconshreveable/go-update"
)
const VERSION = "0.1.0"
// Updates work like this: each version is stored in a folder on a Linode
// server operated by the developers. The most recent version is stored in
// current/... |
package simra
import (
"github.com/pankona/gomo-simra/simra/fps"
"github.com/pankona/gomo-simra/simra/internal/peer"
)
// Simraer represents an interface of simra instance
type Simraer interface {
// Start needs to call to enable all function belong to simra package.
Start(onStart, onStop func())
// SetScene set... |
package chardet
// Recognizer for single byte charset family
type recognizerSingleByte struct {
charset string
hasC1ByteCharset string
language string
charMap *[256]byte
ngram *[64]uint32
}
func (r *recognizerSingleByte) Match(input *recognizerInput) recognizerOutput {
var c... |
fix GPO missing flags
|
package outbox
import (
"github.com/cloudfoundry-incubator/runtime-schema/bbs"
steno "github.com/cloudfoundry/gosteno"
"github.com/cloudfoundry/yagnats"
)
func Listen(bbs bbs.StagerBBS, natsClient yagnats.NATSClient, logger *steno.Logger) {
for {
runOnces, _, errs := bbs.WatchForCompletedRunOnce()
dance:
for... |
// Copyright (C) 2014 The Syncthing Authors.
//
// 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/.
// +build ignore
package main
import (
"archive/tar"
"archive/zip... |
Fix divide by zero in common.DemoHeader.FrameTime (#109)
* Return 0 in common.DemoHeader.FrameTime if PlaybackFrames is 0 to avoid dividing by zero
Co-Authored-By: marksamman <da2eb6183c9fa7ea83988ee64046b05ce0ddaae1@gmail.com>
|
// Input/output handling for GoAWK interpreter
package interp
import (
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"strconv"
"strings"
. "github.com/benhoyt/goawk/internal/ast"
. "github.com/benhoyt/goawk/lexer"
)
// Print a line of output followed by a newline
func (p *interp) printLine(writer... |
change the interval field of metadata plugin to execution_interval
|
package main
import (
"database/sql"
"encoding/xml"
"flag"
irc "github.com/fluffle/goirc/client"
_ "github.com/go-sql-driver/mysql"
"io/ioutil"
"log"
"net/http"
"strings"
)
type Config struct {
Channel string
DBConn string
BotName string
}
var config Config
func sendUrl(channel, url string, conn *irc.C... |
package index
import (
"bufio"
"crypto/sha512"
"encoding/hex"
"github.com/tywkeene/autobd/options"
"io"
"io/ioutil"
"os"
"path"
"time"
)
type Index struct {
Name string `json:"name"`
Checksum string `json:"checksum,omitempty"`
Size int64 `json:"size"`
ModTime ti... |
golint
|
package inject_test
import (
"testing"
"github.com/daaku/go.inject"
)
type Answerable interface {
Answer() int
}
type TypeAnswerStruct struct {
answer int
private int
}
func (t *TypeAnswerStruct) Answer() int {
return t.answer
}
type TypeNestedStruct struct {
A *TypeAnswerStruct `inject:""`
}
func (t *Ty... |
package scanner
import (
"encoding/gob"
"errors"
"fmt"
"github.com/Symantec/Dominator/lib/image"
"github.com/Symantec/Dominator/objectserver"
"os"
"path"
"syscall"
)
func loadImageDataBase(baseDir string, objSrv objectserver.ObjectServer) (
*ImageDataBase, error) {
fi, err := os.Stat(baseDir)
if err != nil... |
// 在这里写你的事件
package main
import (
"github.com/ying32/govcl/vcl"
)
//::private::
type TMainFormFields struct {
}
func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
f.hideAllTab()
f.PageControl1.SetActivePageIndex(0)
}
func (f *TMainForm) hideAllTab() {
var i int32
for i = 0; i < f.PageControl1.PageCount();... |
// This is a "stub" file. It's a little start on your solution.
// It's not a complete solution though; you have to write some code.
// Package acronym should have a package comment that summarizes what it's about.
// https://golang.org/doc/effective_go.html#commentary
package acronym
func Abbreviate(string) string
... |
// 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 2017 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... |
package network
import (
"bufio"
"encoding/binary"
"fmt"
"io/ioutil"
"net"
"os"
"os/exec"
"reflect"
"strconv"
"strings"
"sync"
"github.com/pkg/errors"
"github.com/lxc/lxd/lxd/apparmor"
"github.com/lxc/lxd/lxd/cluster"
"github.com/lxc/lxd/lxd/daemon"
"github.com/lxc/lxd/lxd/dnsmasq"
"github.com/lxc/l... |
package drivers
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
"golang.org/x/sys/unix"
"github.com/lxc/lxd/lxd/project"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
)
func wipeDirectory(path string) error {
// List all entries
entries, err := ioutil.ReadDir(path)
if err... |
package ticketmatic
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"reflect"
"strings"
"time"
)
// API server to use.
var Server = "https://apps.ticketmatic.com"
// API version
var Version = "1"
// Library Version
const Build = ... |
package handlers
import (
"fmt"
"github.com/alphagov/router/logger"
"io/ioutil"
"net"
"net/http"
"net/http/httputil"
"net/url"
"strings"
"syscall"
"time"
)
func NewBackendHandler(backendUrl *url.URL, connectTimeout, headerTimeout time.Duration, logger logger.Logger) http.Handler {
proxy := httputil.NewSing... |
// +build linux,cgo,!agent
package db
import (
"database/sql"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/lxc/lxd/lxd/db/query"
"github.com/lxc/lxd/lxd/instance/instancetype"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/osarch"
)
// Code generation directives.
//
//go:generate -command m... |
package slackscot
// GENERATED and MANAGED by giddyup (https://github.com/alexandre-normand/giddyup)
const (
// VERSION represents the current slackscot version
VERSION = "1.46.0"
)
📈 Bump Version
package slackscot
// GENERATED and MANAGED by giddyup (https://github.com/alexandre-normand/giddyup)
const (
// VER... |
package main
const VERSION = "0.14"
Release version 0.15
package main
const VERSION = "0.15"
|
// Originally derived from: btcsuite/btcd/version.go
// Copyright (c) 2013-2015 The btcsuite developers
// Copyright (c) 2015 Monetas.
// Copyright 2016 Daniel Krawisz.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"fmt"
"strings"
... |
package main
/*
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.
*/
const VersionMajor = 4
const VersionMinor = 9
con... |
package main
const VERSION = "0.11.0-alpha1"
:+1: Bump up the version 0.11.0-alpha2
package main
const VERSION = "0.11.0-alpha2"
|
package main
import (
"fmt"
"strconv"
"strings"
"time"
)
func GetVersion() string {
if e, err := strconv.ParseInt(buildTimestamp, 10, 64); err == nil {
buildTimestamp = time.Unix(e, 0).Format(time.RFC3339)
}
return fmt.Sprintf("%s built from %s at %s",
strings.TrimPrefix(version, "v"), gitVersion,
buildT... |
package sdk
const VERSION = "v1.14.1"
Incremented version.
package sdk
const VERSION = "v1.14.3"
|
package join
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
"sync"
"time"
"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/coreos/etcd/client"
"github.com/coreos/etcd/rafthttp"
"github.com/coreos/etcd/store"
"github.com/davecgh/go-sp... |
package proxy
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"regexp"
"strings"
"github.com/fsouza/go-dockerclient"
"github.com/weaveworks/weave/common"
)
var (
containerIDRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/([^/]*)/.*")
weaveWaitEntrypoint = []string{... |
package rxgo
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/reactivex/rxgo/options"
)
var _ = Describe("Connectable Observable", func() {
Context("when creating two subscriptions to a connectable observable", func() {
in := make(chan interface{}, 2)
out1 := make(chan interface{}, 2... |
package viewLib
import (
"encoding/json"
"fmt"
"log"
"os"
"strconv"
"sync"
"time"
"github.com/boltdb/bolt"
)
//counter is an instance of a [pageName]pageView hash map. This is implemented with a
//mutex RW lock to stop goroutine data races
var counter = struct {
sync.RWMutex
m map[string]int
}{m: make(map[... |
package discoverd
import (
"fmt"
"os"
"strings"
"sync"
"sync/atomic"
"time"
hh "github.com/flynn/flynn/pkg/httphelper"
)
// EnvInstanceMeta are environment variables which will be automatically added
// to instance metadata if present.
var EnvInstanceMeta = map[string]struct{}{
"FLYNN_APP_ID": {},
"FL... |
package zog
import (
"fmt"
"strings"
)
type Instruction interface {
String() string
Encode() []byte
}
type LD8 struct {
InstBin8
}
func NewLD8(dst Loc8, src Loc8) *LD8 {
return &LD8{InstBin8{dst: dst, src: src}}
}
func (l *LD8) String() string {
return fmt.Sprintf("LD %s, %s", l.dst, l.src)
}
func (l *LD8) ... |
/*
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, ... |
/*
Copyright 2014 CoreOS Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... |
package beertasting
import (
"appengine"
"appengine/datastore"
"appengine/urlfetch"
"appengine/user"
"encoding/json"
"fmt"
"github.com/ant0ine/go-json-rest/rest"
"html/template"
"io/ioutil"
"net/http"
"net/url"
"path"
"strconv"
"strings"
"time"
)
var (
endpoint = url.URL{Scheme: "http", Host: "api.unt... |
// Copyright 2017 The Prometheus 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 t... |
package gpio
import (
"container/heap"
"fmt"
"io"
"os"
"syscall"
"time"
)
type watcherAction int
const (
watcherAdd watcherAction = iota
watcherRemove
watcherClose
)
type watcherCmd struct {
pin Pin
action watcherAction
}
// WatcherNotification represents a single pin change
// The new value of the p... |
package main
import (
"fmt"
"github.com/longears/sortpixels/myimage"
"github.com/longears/sortpixels/utils"
"os"
"runtime"
"runtime/debug"
"strings"
)
// How many times to repeat the vertical & horizontal sort step
const N_SORTS = 6
// How many threads to run in parallel
var THREADPOOL_SIZE int
func init() {... |
package main
import (
"fmt"
"github.com/longears/sortpixels/myimage"
"github.com/longears/sortpixels/utils"
"os"
"runtime"
"runtime/debug"
"strings"
)
// How many times to repeat the vertical & horizontal sort step
const N_SORTS = 6
// How many threads to run in parallel
var THREADPOOL_SIZE int
func init() {... |
/*
* Minio Client (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
package inputsocket
import (
"bufio"
"context"
"io"
"net"
"os"
reuse "github.com/libp2p/go-reuseport"
"github.com/tsaikd/KDGoLib/errutil"
codecjson "github.com/tsaikd/gogstash/codec/json"
"github.com/tsaikd/gogstash/config"
"github.com/tsaikd/gogstash/config/goglog"
"github.com/tsaikd/gogstash/config/logev... |
/*
Copyright IBM Corp All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package e2e
import (
"encoding/json"
"io/ioutil"
"os"
"syscall"
"time"
docker "github.com/fsouza/go-dockerclient"
"github.com/hyperledger/fabric/integration/nwo"
"github.com/hyperledger/fabric/integration/nwo/commands"
. "git... |
// Copyright 2016 The etcd 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 t... |
package checker
import (
"context"
"fmt"
"io"
"os"
"sync"
"github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/pack"
"github.com/restic/restic/internal/repository"
"github.com/restic/restic/internal/restic"
"github.com/restic/restic/interna... |
package clients
import (
"context"
"fmt"
"github.com/manicminer/hamilton/auth"
"github.com/manicminer/hamilton/environments"
"github.com/hashicorp/terraform-provider-azuread/internal/common"
)
type ClientBuilder struct {
AuthConfig *auth.Config
PartnerID string
TerraformVersion string
}
// Bui... |
// Copyright 2019 The Go Cloud Development Kit 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
//
// Unless required by appli... |
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package frontend provides functionality for running the pkg.go.dev site.
package frontend
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/http"
"... |
package redconn
import (
"encoding/json"
"fmt"
"log"
"math"
"math/rand"
"time"
"github.com/PuerkitoBio/exp/juggler/msg"
"github.com/garyburd/redigo/redis"
"github.com/pborman/uuid"
)
// Pool defines the methods required for a redis pool that provides
// a method to get a connection and to release the pool's... |
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package repo
import (
"container/list"
"path"
"strings"
"github.com/unknwon/com"
log "gopkg.in/clog.v1"
"github.com/gogs/git-module"
"gogs.io/gogs/... |
package sctp
import (
"testing"
"github.com/gotestyourself/gotestyourself/assert"
"github.com/pkg/errors"
)
func TestInitChunk(t *testing.T) {
pkt := &Packet{}
rawPkt := []byte{0x13, 0x88, 0x13, 0x88, 0x00, 0x00, 0x00, 0x00, 0x81, 0x46, 0x9d, 0xfc, 0x01, 0x00, 0x00, 0x56, 0x55,
0xb9, 0x64, 0xa5, 0x00, 0x02, 0... |
package uvm
import (
"fmt"
"io"
"net"
"os"
"path/filepath"
"strings"
"github.com/Microsoft/hcsshim/internal/gcs"
"github.com/Microsoft/go-winio"
"github.com/Microsoft/go-winio/pkg/guid"
"github.com/Microsoft/hcsshim/internal/logfields"
"github.com/Microsoft/hcsshim/internal/mergemaps"
hcsschema "github.c... |
package version
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"reflect"
"runtime"
"strings"
"text/tabwriter"
"github.com/blang/semver"
"github.com/cri-o/cri-o/utils"
"github.com/google/renameio"
json "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"... |
package version
// Version describes module version
const Version = "1.6.3"
bump up version to release 1.6.4
package version
// Version describes module version
const Version = "1.6.4"
|
package sum
func basic(sum int, nums ...int) bool {
for _, x := range nums {
for _, y := range nums {
s := x + y
if sum == s {
return true
}
}
}
return false
}
func better(sum int, nums ...int) bool {
max := len(nums)
for ix := 0; ix < max; ix++ {
x := nums[ix]
for iy := ix + 1; iy < max; iy... |
package shellquote
import (
"reflect"
"testing"
)
func TestSimpleSplit(t *testing.T) {
for _, elem := range simpleSplitTest {
output, err := Split(elem.input)
if err != nil {
t.Errorf("Input %q, got error %#v", elem.input, err)
} else if !reflect.DeepEqual(output, elem.output) {
t.Errorf("Input %q, got... |
package main
import (
"image/color"
"io"
"strconv"
"github.com/MJKWoolnough/byteio"
"github.com/MJKWoolnough/gopherjs/files"
"github.com/MJKWoolnough/gopherjs/progress"
"github.com/MJKWoolnough/gopherjs/xjs"
"github.com/gopherjs/gopherjs/js"
"github.com/gopherjs/websocket"
"honnef.co/go/js/dom"
)
var uploa... |
package wfe
import (
"context"
"crypto"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/mail"
"net/url"
"os"
"path"
"sort"
"strconv"
"strings"
"time"
"unicode"
"gopkg.in/square/go-jose.v2"
"github.com/... |
package q
import (
"strings"
"github.com/leeola/fixity/q/operator"
"github.com/leeola/fixity/value"
"github.com/mgutz/str"
)
// FromString produces a Query from the given string.
//
// Intended for constructing Queries from user input.
//
// TODO(leeola): support AND/OR by looking check if one of the parts equal... |
// Package chain enables flexible ordering and reuse of context-aware Handler
// wrapper chains.
package chain
import (
"net/http"
"golang.org/x/net/context"
)
// Handler interface must be implemented for a function to be able to be
// wrapped, or served.
type Handler interface {
ServeHTTPContext(context.Context,... |
package wkg
type ByteOrder uint8
const (
BigEndian = iota
LittleEndian
)
type Coord uint32
const (
Coord2D = iota << 4
CoordZ
CoordM
CoordZM
)
type GeomType uint32
const (
_ = iota
GeomPoint
GeomLineString
GeomPolygon
GeomMultiPoint
GeomMultiLineString
GeomMultiPolygon
GeomGeometryCollection
)
Prot... |
package main
import "flag"
import "fmt"
import "strings"
type Formula struct {
value string
left *Formula
right *Formula
}
func parseFormula(f string) *Formula {
if strings.HasPrefix(f, "(") && strings.HasSuffix(f, ")") {
for _, connective := range []string{"^", "v", ">"} {
if strings.Contains(f, connectiv... |
// Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information
package interfacer
import (
"fmt"
"go/ast"
"go/token"
"go/types"
"io"
"os"
"path/filepath"
"sort"
"strings"
"golang.org/x/tools/go/loader"
)
func toDiscard(vu *varUsage) bool {
if vu.discard {
return true
}
... |
package main
import (
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
)
func check(paths, exclude []string, coverage, verbose bool) error {
excludeMap := make(map[string]struct{})
for _, ex := range exclude {
excludeMap[ex] = struct{}{}
}
var (
files []string
testDirs []string
testFileDi... |
// 29 december 2012
package main
import (
"fmt"
"os"
"io"
"path/filepath"
"archive/zip"
"strconv"
"crypto/sha1"
"encoding/hex"
"bytes"
"log"
)
var sha1hash = sha1.New()
func crc32match(zipcrc uint32, gamecrc string) bool {
if gamecrc == "" { // assume lack of CRC32 means do not check
return true
}
n, ... |
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package web defines minimal helper routines for accessing HTTP/HTTPS
// resources without requiring external dependenicies on the net package.
//
// If the c... |
package xpc
/*
#include "xpc_wrapper.h"
*/
import "C"
import (
"errors"
"fmt"
"log"
"reflect"
"strings"
"unsafe"
)
type XPC struct {
conn C.xpc_connection_t
}
func (x *XPC) Send(msg interface{}, verbose bool) {
// verbose == true converts the type from bool to C._Bool
C.XpcSendMessage(x.conn, goToXpc(msg),... |
/*******************************************************************************
The MIT License (MIT)
Copyright (c) 2013 Hajime Nakagami
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without r... |
// Package clock is a low consumption, low latency support for frequent updates of large capacity timing manager:
// 1、能够添加一次性、重复性任务,并能在其执行前撤销或频繁更改。
// 2、支持同一时间点,多个任务提醒。
// 3、适用于中等密度,大跨度的单次、多次定时任务。
// 4、支持10万次/秒的定时任务执行、提醒、撤销或添加操作,平均延迟10微秒内
// 5、支持注册任务的函数调用,及事件通知。
// 基本处理逻辑:
// 1、重复性任务,流程是:
// a、注册重复任务
// b、时间抵达时,控制器调... |
package cmdns
import (
"errors"
"fmt"
"github.com/spf13/cobra"
)
var (
// DefaultNamespacer is the default namespacer for the package
DefaultNamespacer = New()
// DefaultNamespaceSeperator is the char that seperates commands
DefaultNamespaceSeperator = ':'
)
// SetOverrideUsageFunc when set to true will ove... |
package color
import (
"fmt"
"os"
"strconv"
"strings"
"sync"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
)
// NoColor defines if the output is colorized or not. It's dynamically set to
// false or true based on the stdout's file descriptor referring to a terminal
// or not. This is a global o... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"
"time"
)
func doHTTP(url string, input io.Reader) (io.ReadCloser, error) {
method := "GET"
if input != nil {
method = "POST"
}
rq, err := http.NewRequest(method, url, input)
if err != nil {
return nil, err
}
r... |
package dalga
import (
"database/sql"
"flag"
"fmt"
"log"
"net"
"strconv"
"strings"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/streadway/amqp"
)
const createTableSQL = "" +
"CREATE TABLE `%s` (" +
" `routing_key` VARCHAR(255) NOT NULL," +
" `body` BLOB(767) NOT NULL," +
" `... |
package node
import (
"errors"
"log"
"sync"
)
// Takes care of maintaining and relaying maps and insures that we know which
// interfaces can reach which addresses.
type ReachabilityHandler interface {
AddConnection(NodeAddress, MapConnection)
FindNextHop(NodeAddress) (NodeAddress, error)
}
type taggedMap struc... |
package zip
import (
"archive/zip"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
)
func Archive(inPath string, outPath string, includeRootDir bool) error {
inFileInfo, err := os.Stat(inPath)
if err != nil {
return err
}
outFile, err := os.Create(outPath)
if err != nil {
return err
}
defer outFile.Clo... |
// Package zk is a native Go client library for the ZooKeeper orchestration service.
package zk
/*
TODO:
* make sure a ping response comes back in a reasonable time
Possible watcher events:
* Event{Type: EventNotWatching, State: StateDisconnected, Path: path, Err: err}
*/
import (
"crypto/rand"
"encoding/binary"
... |
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"github.com/howeyc/fsnotify"
"github.com/naoina/kocha"
)
const DEFAULT_KOCHA_ENV = "dev"
type runCommand struct {
flag *flag.FlagSet
}
func (c *runCommand) Name() string {
return "run"
}
func (c *runCommand) Alias() string {
re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.