text
stringlengths
11
4.05M
// Package cassandra contains Cassandra driver for Gocrud. // Testing of this package, works best via linux, unless you have // cassandra tools installed on your Mac. // To test this cassandra integration, run cassandra on docker // $ docker pull poklet/cassandra // $ docker run --detach --name cassone poklet/cassandra...
package main import "fmt" func main(){ var t int = 0x7fffffffffffffff fmt.Println(t) t += 1 fmt.Println(t) t += 1 fmt.Println(t) }
/* * Copyright (c) 2020 - present Kurtosis Technologies LLC. * All Rights Reserved. */ package testsuite // Docs available at https://docs.kurtosistech.com/kurtosis-libs/lib-documentation type TestSuite interface { // Docs available at https://docs.kurtosistech.com/kurtosis-libs/lib-documentation GetTests() map[...
// Package server provides a server for handling worker gRPC communication. package server import ( "context" "crypto/tls" "net" "github.com/dkorittki/loago/internal/pkg/worker/handler" "github.com/dkorittki/loago/pkg/api/v1" grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware" grpcauth "github.com/gr...
package detection import ( "context" "fmt" "github.com/giantswarm/apiextensions/pkg/apis/provider/v1alpha1" "github.com/giantswarm/microerror" "github.com/giantswarm/micrologger" "github.com/giantswarm/aws-operator/service/controller/legacy/v27/controllercontext" "github.com/giantswarm/aws-operator/service/co...
// // Last.Backend LLC CONFIDENTIAL // __________________ // // [2014] - [2018] Last.Backend LLC // All Rights Reserved. // // NOTICE: All information contained herein is, and remains // the property of Last.Backend LLC and its suppliers, // if any. The intellectual and technical concepts contained // herein are prop...
package main import "fmt" func main() { var intLink Link = Link{} for i := 0; i < 10; i++ { //intLink.InsertHead(i) intLink.InsertTail(fmt.Sprintf("node:%d",i)) } intLink.Traverse() }
package backtracking import ( "testing" ) func TestCal8Queens(t *testing.T) { Cal8Queens(0) }
package main import "fmt" func main() { p := &Player{ Id: 1, Name: "Depa", Age: 20, } fmt.Println(p.getName()) p.changeName("ALFI") fmt.Println(p.getName()) } type Player struct { Id int Name string Age int } func (p *Player) changeName(newName string) { p.Name = newName } func (p *Player) ge...
package realm import ( "testing" "github.com/10gen/realm-cli/internal/utils/test/assert" ) func TestAppResolveProducts(t *testing.T) { t.Run("should return the list of default products when none are provided", func(t *testing.T) { var emptyArr []string for _, tc := range [][]string{ nil, []string{}, ...
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. package restore import ( "bytes" "cmp" "context" "crypto/tls" "encoding/hex" "encoding/json" "fmt" "math" "slices" "strconv" "strings" "sync" "time" "github.com/fatih/color" "github.com/opentracing/opentracing-go" "github.com/pingcap/errors" ...
package indexer import ( "github.com/idena-network/idena-go/core/appstate" "github.com/idena-network/idena-indexer/db" ) type conversionContext struct { blockHeight uint64 submittedFlips []db.Flip flipKeys []db.FlipKey flipsWords []db.FlipWords flipsData []db.FlipData flipSize...
/* Package twofer implements functionality for sharing things with others. */ package twofer // ShareWith returns are string containing the given name // if the name is empty 'you' is used func ShareWith(name string) string { if name == "" { return "One for you, one for me." } return "One for " + name + ", one fo...
package main import ( "bufio" "fmt" "os" "sort" "strconv" "strings" ) const ( impossible = "IMPOSSIBLE" cameron = "C" jamie = "J" ) type StartEnd struct { start int end int str *string } type Parent struct { name string freeTime int } func main() { var nrTestCases int var nrActiviti...
// Copyright 2019 PingCAP, 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 i...
/* Command-lne app to convert Rimu source to HTML. */ package main import ( "fmt" "io/ioutil" "os" "os/user" "path" "path/filepath" "strconv" "strings" "github.com/srackham/go-rimu/v11/internal/utils/stringlist" "github.com/srackham/go-rimu/v11/rimu" ) var osExit = os.Exit // Mocked by tests. const VER...
package main import ( //For swagger "github.com/iris-contrib/swagger" "github.com/iris-contrib/swagger/swaggerFiles" _ "go-mysql/docs" "github.com/kataras/iris" "go-mysql/config" _ "go-mysql/controller" _ "go-mysql/controller/userController" "go-mysql/router" "os" ) // @title CRUD MySql API // @version 1.0...
/* * Copyright (c) 2021. Ant Group. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 */ package exporter import ( "github.com/prometheus/client_golang/prometheus" ) var ( Registry = prometheus.NewRegistry() ) func init() { Registry.MustRegister( ReadCount, OpenFdCount, OpenFdMaxCount, Las...
package main import ( "github.com/gorilla/websocket" "log" "net/http" "os" ) var upgrader = websocket.Upgrader{} var broadcastChannel chan (Serializable) func broadcaster() { for { msg := <-broadcastChannel for _, client := range connectionPool { if client != nil && msg.BroadcastOk(client) { client.S...
package main import ( "context" "fmt" "google.golang.org/grpc" "log" "net/http" "os" "time" ) import pb "github.com/alfssobsd/kube-grpc-example/baseproto" func main() { //Get grpc server address from env `GRPC_SERVER_ADDR` address := os.Getenv("GRPC_SERVER_ADDR") conn, err := grpc.Dial(address, grpc.WithIn...
package sort import ( "fmt" "goqueue/pkg/array" "time" ) // SortTask holds the attributes needed to perform unit of work type SortTask struct { ID int arr array.IArray writerID int createDt int64 } // New creates SortTask object, takes an array for sorting and a producer id func New(arr array.IArra...
package src import ( "fmt" "github.com/llir/llvm/ir" "github.com/llir/llvm/ir/constant" "github.com/llir/llvm/ir/enum" "github.com/llir/llvm/ir/types" "github.com/llir/llvm/ir/value" ) // implements visitor type Generator struct { Root *RootAST Module *ir.Module CurrentBlock []*ir.Block // blo...
package notifier // should be something like singleton type Notifier interface { // requires id from which you want to get metrics. 0 for "from the beginning" // returns // 1. id of last entry // 2. list of metrics // 3. true if set is incomplete and we need to do a full scan GetNewMetrics(id int) (int, []string...
package postgres import ( "context" core "github.com/Qalifah/aboki-africa-assessment" ) type PointRepository struct { client *Client } func NewPointRepository(client *Client) *PointRepository { return &PointRepository{ client: client, } } func(p *PointRepository) CreatePoint(ctx context.Context, point *core...
package v1alpha1 import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type RoleName string const ( MasterRole RoleName = "master" SlaveRole RoleName = "slave" NamesrvRole RoleName = "namesrv" ConsoleRole RoleName = "console" ConsoleImage string = "riet/r...
package drivers import ( "bytes" "encoding/json" "fmt" "os" "reflect" "runtime" "strings" "testing" ) var testBinaryDriver = fmt.Sprintf("#!/bin/sh\ncat <<EOF%s\nEOF\n", testBinaryJSON) var testWarningBinaryDriver = `#!/bin/sh echo "warning binary" 1>&2 echo "{}" ` var testBadBinaryDriver = `#!/bin/sh echo "b...
package main import ( "errors" "log" "net/http" "os" "path/filepath" "github.com/hectron/go-define/lingua" "github.com/spf13/viper" "github.com/urfave/cli/v2" ) const AppName = "go-define" // this is injected using ldflags during compile time // @see Makefile var Version = "" func main() { app := &cli.App...
package main import ( "fmt" "strings" "time" ) /* "Index" means our list (slice) of pages */ type Page struct { BaseDir string // Usually "pages", used to mkdir -p (mkdirall) LinkDir string // Just BaseDir without the pages for generating links FileName string // Actual file name like "index.html" Name ...
package init import ( _ "github.com/GM-Publicchain/gm/plugin/consensus/para" //auto gen _ "github.com/GM-Publicchain/gm/plugin/consensus/pbft" //auto gen _ "github.com/GM-Publicchain/gm/plugin/consensus/raft" //auto gen _ "github.com/GM-Publicchain/gm/plugin/consensus/tendermint" //auto gen _ "g...
package main import ( "reflect" "strings" "testing" ) func Test_day17GetPath(t *testing.T) { maze := strings.TrimSpace(` #######...##### #.....#...#...# #.....#...#...# ......#...#...# ......#...###.# ......#.....#.# ^########...#.# ......#.#...#.# ......######### ........#...#.. ....#########.. ....#...#...... ....
package main import ( "fmt" "io/ioutil" "log" "net/http" "regexp" "strconv" "strings" ) func paqu(xuehao int) []byte { resp, err := http.Get("http://jwc.cqupt.edu.cn/kebiao/kb_stu.php?xh=" + strconv.Itoa(xuehao)) if err != nil { fmt.Println(err) log.Fatal(err) } defer resp.Body.Close() body, err := io...
package gpay import ( "testing" "fmt" "io/ioutil" ) func TestEnter_Handle(t *testing.T) { en := new(Enter) pfxData,_ := ioutil.ReadFile("test.pfx") en.InitBaseConfig(&BaseConfig{ AgentNo:"zl@cs.sh.cn", Key:"ZD7D0ZM7SC8CVV6Q", PfxData:pfxData, CertPassWord:"12345678", }) picInfo := new (PicInfo) pi...
package converter import ( "io/ioutil" "os" "path/filepath" ) const ( defaultFileName = "docker-compose.yml" ) type ComposeReader struct{} func (cr *ComposeReader) Read(filename string) ([]byte, error) { cwd, err := os.Getwd() if err != nil { return nil, err } path, err := filepath.Rel(cwd, filepath.Join...
package runtime //Block is a code block within a script. type Block struct { runtime *Runtime Parent *Block Statements []func() Variables map[string]interface{} Args map[int]interface{} } //NewBlock returns a new block. func (runtime *Runtime) NewBlock() *Block { var block = new(Block) block.runtime = ...
package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" ) var db *sql.DB type gotest struct { //定义结构体存储数据库数据 id int name string salary int } type restype []gotest //为存储多个记录,定义切片 func initdb() (err error) { sqn := `root:123456@tcp(192.168.56.101:3306)/gotest` db, err = sql.Open(...
package test import ( "github.com/stretchr/testify/assert" ) func iCallIsHealthyMethod() error { scenarioState.subject, scenarioState.lastError = f.c.IsHealthy() if scenarioState.lastError != nil { return scenarioState.lastError } return nil } func iShouldReceiveTrueAsResponse() error { return assertExpecte...
package models import g "github.com/vseledkin/gortex" type Classifier interface { Forward(G *g.Graph, tokens []string) (class uint, confidence float32) Load(modelFile string) error Save(modelFile string) error GetClasses() map[string]*struct{ Index, Count uint } GetClassName(c uint) string GetLogits() *g.Matrix...
package main import ( "bytes" "crypto/sha1" "encoding/binary" "encoding/hex" "errors" "flag" "fmt" "html/template" "io" "io/ioutil" "log" "os" "os/exec" "path/filepath" "runtime" "strconv" "strings" "sync" "time" ) // Debug flag var Debug = flag.Bool("debug", false, "enable debug output") func pro...
package cv type ExperienceItem struct { Name string StartDate string `yaml:"start_date"` EndDate string `yaml:"end_date"` Position string Description string } // EducationItem is representation of education history type EducationItem struct { Name string StartDate string `yaml:"start_date"` EndDate string `ya...
package SiZhu // 干支 import ( . "github.com/warrially/BaziGo/Common" ) // 获得八字年的干支,0-59 对应 甲子到癸亥 func GetGanZhiFromYear(nYear int) int { if nYear > 0 { return (nYear - 4) % 60 } else { // 需要独立判断公元前的原因是没有公元 0 年 return (nYear - 3) % 60 } } // 获得八字年的干支,0-59 对应 甲子到癸亥, 加字符串 func GetGanZhiFromYear2(pGanZhi *TGanZh...
package main import ( "fmt" "os" "time" "github.com/jhampac/xkattle/database" ) func main() { cwd, _ := os.Getwd() state, err := database.NewStateFromDisk(cwd) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } defer state.Close() block0 := database.NewBlock( database.Hash{}, uint64(time.No...
package main import( "fmt" "github.com/golang/protobuf/proto" "crypto/tls" "net/http" "encoding/base64" example "main/protospb/example_ID" ) func GetProtos(brandIDs ...string){ http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} for _,brand :=range brandIDs{ messa...
package main func main() { } func countSubstrings(s string) int { n := len(s) t := "$#" for i := 0; i < n; i++ { t += string(s[i]) + "#" } n = len(t) t += "!" f := make([]int, n) iMax, rMax, ans := 0, 0, 0 for i := 1; i < n; i++ { // 初始化 f[i] if i <= rMax { f[i] = min(rMax-i+1, f[2*iMax-i]) } el...
package main type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func diameterOfBinaryTree(root *TreeNode) int { c, m := diameter(root) return max(c-1, m) } func diameter(node *TreeNode) (int, int) { if node == nil { return 0, 0 } lCount, lMax := diameter(node.Left) rCount, rMax := diamete...
package main type Table struct { b []byte }
/* Copyright 2021 The KubeVela 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, softw...
package main import ( "encoding/json" "flag" "fmt" "os" "github.com/rtfreedman/weather" ) var zipCode = flag.Int("zip", 20175, "supply zip code") func main() { // create a client from our api key client := weather.NewClient(os.Getenv("EXAMPLE_API_KEY")) // grab the weather based on the zip code we want w,...
// +build js,wasm package method import ( "strconv" "syscall/js" ) var document js.Value func init() { document = js.Global().Get("document") } func Add(i []js.Value) { value1 := document.Call("getElementById", i[0].String()).Get("value").String() value2 := document.Call("getElementById", i[1].String()).Get("...
// Copyright 2018 The go-bindata Authors. All rights reserved. // Use of this source code is governed by a CC0 1.0 Universal (CC0 1.0) // Public Domain Dedication license that can be found in the LICENSE file. package bindata import ( "sort" ) // Translate reads assets from an input directory, converts them // to G...
package db import ( "context" "fmt" "github.com/eltonjr/graphql-server-exercise/model" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo/options" ) const driversCollection = "drivers" func GetDrivers(skip, limit int) ([]*model.Driver, error) { ...
package csv2geojson import ( "os" flags "github.com/jessevdk/go-flags" ) type Options struct { Jobs int `short:"j" long:"jobs" default:"1" description:"Set number of converter jobs"` Limit int `short:"l" long:"limit" description:"Set number of converted features limit"` Output string `short:"o" ...
package tusdx import ( "encoding/json" "fmt" "github.com/gomodule/redigo/redis" "github.com/maxtech/tusdx/tusdx_model" ) var ( redisPool *redis.Pool prefix = "tusd" ) func getTusdFileFromRedis(id string) *tusdx_model.TusdFilesModel { var tusdFile *tusdx_model.TusdFilesModel = nil ...
// Copyright 2021 The Gitea 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 hostmatcher import ( "net" "testing" "github.com/stretchr/testify/assert" ) func TestHostOrIPMatchesList(t *testing.T) { type tc struct { ho...
package kucoin import ( "net/http" ) // A CurrencyModel represents a model of known currency. type CurrencyModel struct { Name string `json:"name"` Currency string `json:"currency"` FullName string `json:"fullName"` Precision uint8 `json:"precision"` Confirms int...
package main import ( "flag" "fmt" ) func main() { flag.Parse() for _, s := range flag.Args() { fmt.Print(s, " ") } fmt.Println("🍺 🍺 🍺 ") }
package gtime import "testing" func TestNewTime(t *testing.T) { t.Log(NewTime(NowInMilli())) } func TestNowInMilli(t *testing.T) { t.Log(NowInMilli()) }
package core import ( "log" "path/filepath" "strings" "time" "github.com/jonmorehouse/gatekeeper/gatekeeper" loadbalancer_plugin "github.com/jonmorehouse/gatekeeper/plugin/loadbalancer" metric_plugin "github.com/jonmorehouse/gatekeeper/plugin/metric" modifier_plugin "github.com/jonmorehouse/gatekeeper/plugin/...
package leetcode /*Given a non-negative integer num, return the number of steps to reduce it to zero. If the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero 著作权归领扣网络所有。商业转载请联系官...
package base import ( "errors" "gengine/context" "reflect" ) type ElseStmt struct { StatementList *Statements } func (e *ElseStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) { if e.StatementList != nil { return e.StatementList.Evaluate(dc, Vars) } else { ...
///////////////////////////////////////////////////////////////////// // arataca89@gmail.com // 20210417 // // func ToLowerSpecial(c unicode.SpecialCase, s string) string // // Retorna s com todas as letras minúsculas conforme o mapeamento // especificado por c. // package main import ( "fmt" "strings...
package dialog import ( "github.com/therecipe/qt/core" _ "github.com/therecipe/qt/internal/examples/showcases/wallet/wallet/dialog/controller" ) func init() { unlockTemplate_QmlRegisterType2("DialogTemplate", 1, 0, "UnlockTemplate") } type unlockTemplate struct { dialogTemplate _ func(string) *cor...
package main import ( "bytes" "errors" "fmt" "math" "net/http" "net/url" "strings" "sync" "text/template" log "github.com/sirupsen/logrus" "github.com/spf13/viper" "github.com/theckman/httpforwarded" ) // cache SQL/HTML templates so repeated filesystem reads are not required var globalTemplates map[strin...
package codedeployhook import ( "fmt" ) type RevisionInfo struct { Version string `json:"version"` Resources []map[string]Resource `json:"Resources"` } type Resource struct { Type string `json:"Type"` Properties Properties `json:"Properties"` } type Properties struct { Name ...
package test import ( "github.com/stetsd/blo-go/middlewares" "github.com/stetsd/blo-go/models" "github.com/stetsd/blo-go/store" "net/http" "net/http/httptest" "os" "testing" "github.com/gin-gonic/gin" ) var tmpUserList []models.User var tmpArticleList []models.Article var userList []models.User var articleL...
package main import ( "fmt" "time" ) func main() { fmt.Println("现在的时间是:", time.Now()) fmt.Println("现在的时间是:", time.Now().Format("2006-01-02 15:04:05")) time1 := time.Now() fmt.Println("现在的时间是:", time1.Add(time.Second*3600).Format("2006-01-02 15:04:05")) //获得一个unixDate t, err := time.Parse(time.UnixDate, "Sat ...
package main import ( "flag" "fmt" "io/ioutil" "log" "net/http" "os" "time" "github.com/wiltongarcia/spsc/config" "github.com/wiltongarcia/spsc/timetracker" ) func main() { ms := flag.Int("ms", 1000, "Interval of request in milliseconds") flag.Parse() for { // Config jsonFile, err := os.Open("../conf...
package constant import ( "os" "os/user" P "path" ) const Name = "clash" // Path is used to get the configuration path var Path *path type path struct { homedir string } func init() { currentUser, err := user.Current() var homedir string if err != nil { dir := os.Getenv("HOME") if dir == "" { dir, _ ...
package main import "github.com/micro/go-micro" func main() { micro.Action() }
package aws import ( "context" "fmt" "os" "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" "github.com/pkg/errors" "github.com/sirupsen/logrus" typesaws "github.com/openshift/installer/pkg/types/aws" ) // Subnet holds metadata for a ...
package main import ( "fmt" "html/template" "image/gif" "image/png" "io/ioutil" "net/http" "os" "pixelartscaler/giffactory" "pixelartscaler/processing" "strconv" ) var templates = template.Must(template.ParseFiles("./templates/index.html")) type page struct { ErrorMessage string } func uploadFile(w http....
package discord import ( "fmt" "math/rand" "github.com/bwmarrin/discordgo" ) func (b *Bot) giveNumCmd(num int, m msg, rsp rsp) { num = b.abs(num) res, err := b.db.Query("SELECT COUNT(1) FROM givenum WHERE guild=? AND member=? LIMIT 1", m.GuildID, m.Author.ID) if rsp.Error(err) { return } defer res.Close() ...
package goSolution import "strconv" func openLock(deadends []string, target string) int { lockSet := make(map[string]int) deadEndsSet := make(map[string]bool) for _, deadEnd := range deadends { deadEndsSet[deadEnd] = true } if target == "0000" { return 0 } if deadEndsSet["0000"] { return -1 } q := []s...
func sortTransformedArray(nums []int, a int, b int, c int) []int { ret := make([]int, len(nums)) var start_idx int if a >= 0 { start_idx = len(nums) - 1 } else { start_idx = 0 } l, r := 0, len(nums)-1 for l <= r { if helper(nums[l], a, b, c) > helper(nums[r], a, b, c) { if a >= 0 { ret[start_idx] = ...
package strx import ( "testing" "github.com/stretchr/testify/assert" ) func Test_longestPalindrome(t *testing.T) { palindrome := longestPalindrome("babad") assert.Equal(t, "bab", palindrome) }
package util import ( "context" ) // Ctx var Ctx = context.Background()
package main import ( "encoding/json" "fmt" ) func decodeJsonError() { var result interface{} data := []byte(`{"test":"json"`) // data := []byte(`{"test":"json"}`) err := json.Unmarshal(data, &result) if err != nil { panic(err) } fmt.Println(result) } func main() { decodeJsonError() }
package bench_api import ( "encoding/json" "fmt" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "net/http" "strconv" ) type server struct { router *chi.Mux } type response struct { Message string `json:"message,omitempty"` Input string `json:"input,omitempty"` Fibonacci string `json:"fibo...
// Copyright 2015-2018 trivago N.V. // // 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 users import ( "gopkg.in/mgo.v2/bson" "time" ) type User struct { ID bson.ObjectId `bson:"_id,omitempty" json:"_id"` Name string `bson:"name" json:"name"` Email string `bson:"email" json:"email"` FbToken string `bson:"fb_token" json:"fb_token"` Image string `bson:"image" json:"imag...
/***************************************************************** * Copyright©,2020-2022, email: 279197148@qq.com * Version: 1.0.0 * @Author: yangtxiang * @Date: 2020-08-05 10:20 * Description: *****************************************************************/ package netstream import ( "fmt" "github.com/go-xe2/x/...
// +build kafka /* * Copyright 2018 StreamSets 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 applica...
package GC import ( "fmt" "sync" cmp "github.com/mortim-portim/GraphEng/compression" ) /** Protocoll: Client registers SyncVar -> Payload: [SYNCVAR_REGISTRY | SyncVar.Type() | (2){AccessID}] len() = 4 -> Server sends Confirmation -> Payload: [SYNCVAR_REGISTRY_CONFIRMATION | (2){AccessID}] ...
package sabnzbd type Option func(*Sabnzbd) error func UseHttp() Option { return func(s *Sabnzbd) error { s.useHttp() return nil } } func UseHttps() Option { return func(s *Sabnzbd) error { s.useHttps() return nil } } func Addr(addr string) Option { return func(s *Sabnzbd) error { return s.setAddr(add...
package main import ( "encoding/csv" "encoding/json" "flag" "fmt" "io/ioutil" "log" "net/http" "os" "strconv" "strings" "sync" "github.com/PuerkitoBio/goquery" ) // Keyword - type Keyword struct { ID int `json:"id"` Name string `json:"name"` } // ToString - func (kw *Keyword) ToString() string { ...
package service import ( "github.com/giantswarm/versionbundle" clusterapiv29 "github.com/giantswarm/aws-operator/service/controller/clusterapi/v29" v25 "github.com/giantswarm/aws-operator/service/controller/legacy/v25" v26 "github.com/giantswarm/aws-operator/service/controller/legacy/v26" v27 "github.com/giantsw...
// Copyright (C) 2015 Nicolas Lamirault <nicolas.lamirault@gmail.com> // 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 ...
package field import "bytes" // Fields is a struct containing all possible fields for a single ADAT chunk. type Fields struct { Row *Row FullPath *FullPath Location *Location // Always empty as of Serato DJ Pro 2.0.5 Filename *Filename // Always empty as of Serato DJ Pro 2.0.5 Title *Title Artist ...
package main import ( "fmt" "time" ) func main() { i := 1 // Não existe loop while em Go for i < 10 { fmt.Println(i) i++ } fmt.Println() for i := 1; i < 10; i++ { fmt.Println(i) } // Loop infinito for { fmt.Println("Imprimindo para sempre...") time.Sleep(time.Second) } }
package image_operator import ( "errors" "fmt" "image" "image/color" "math" "os" "github.com/fogleman/gg" // "github.com/golang/freetype" // "github.com/golang/freetype/truetype" ) const ( // 叠加在上部 PositionOverlapTop = iota // 叠加在下部 PositionOverlapBottom // 文字不叠加在图片上,位置在图片上面 PositionConcateTop // 文字不...
package main import ( "encoding/json" "fmt" "github.com/c-mueller/dohblast/blast" "github.com/c-mueller/dohblast/keepalive" "github.com/c-mueller/dohblast/promkeepalive" "github.com/c-mueller/dohblast/qnamegen" "gopkg.in/alecthomas/kingpin.v2" "math/rand" "time" ) var ( blastCmd = kingpin.Command("blast", "...
package models import ( "errors" "github.com/AnhNguyenQuoc/go-blog/lib" "github.com/jinzhu/gorm" ) type User struct { gorm.Model Username string `gorm:"not_null"` Password string `gorm:"not_null"` Email string `gorm:"type:varchar(100);unique_index;unique;not_null"` } type UserService struct { DB *gorm.DB ...
// Copyright 2021 The image-cloner 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 o...
/* * Copyright 2017 StreamSets 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...
// Copyright 2021 PingCAP, 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 i...
package main import ( "context" "crypto/md5" "fmt" ) func md5sumOfString(ctx context.Context, value string) string { md5hash := md5.Sum([]byte(value)) return fmt.Sprintf("%x", md5hash) }
package utils import ( "net/url" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIsStringAbsURL(t *testing.T) { testCases := []struct { name string have string err string }{ { "ShouldBeAbs", "https://google.com", "", }, { "ShouldNotBeAbs"...
package controllers import ( middleware "scholarship/middlewares" "github.com/astaxie/beego" "fmt" "io/ioutil" "encoding/hex" "scholarship/models" ) // Operations about object type ProjectController struct { beego.Controller } // @Title Create // @Description create project // @Param name query string true...
package tester import "fmt" //Tester interface type Tester interface { Test() } //MyFloat64 type type MyFloat64 float64 //Test () method implementation func (m MyFloat64) Test() { fmt.Println(m) } //Describe prints Tester type and value func Describe(t Tester) { fmt.Printf("Interface Tester has a type %T and a...
package core import ( "fmt" "time" "gopkg.in/jeevatkm/go-model.v1" ) // Builder Object for StateService type stateServiceBuilder struct { state stateAdapter cbSettings CircuitBreakerSettings settings StateServiceSettings } // Constructor for StateServiceBuilder func NewStateServiceBuilder() *stateServi...
package operator import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/informers" appsclientv1 "k8s.io/client-go/kubernetes/typed/apps/v1" coreclientv1 "k8s.io/client-go/kubernetes/typed/core/v1" rbacclientv1 "k8s.io/client-go/kubernetes/typed/rbac/v1" "github.com/openshift/library-go/pkg/ope...