text
stringlengths
11
4.05M
package main import ( "dandandowlonad" "os" ) func main() { dondoko := dandandowlonad.NewDanDownload(os.Args[1]) if len(os.Args) == 1 { os.Exit(dondoko.Run()) } else { os.Exit(dondoko.Run2()) } }
package main import ( "encoding/json" "fmt" "log" ) type Response struct { Code int `json:"code"` Result string `json:"result"` } func main() { res := Response{ Code: 200, Result: "Hello Charlie", } json, err := json.Marshal(res) if err != nil { log.Fatal(err) } fmt.Println(string(json)) }
package main import ( "fmt" "encoding/xml" ) type Gpx struct { Creator string `xml:"creator,attr"` Time string `xml:"metadata>time"` Title string `xml:"trk>name"` TrackPoints []TrackPoint `xml:"trk>trkseg>trkpt"` } type TrackPoint struct { Lat float64 `xml:"lat,attr"` Lon float64 `xml:"lon...
package main import ( "fmt" "image/color" "math" ) type vector struct { x, y, z float64 } type ray struct { origin, dir vector transformMatrix m44 } type m44 [4][4]float64 type matrix [][]float64 func NewNormalized(x, y, z float64) vector { l := math.Sqrt(x*x + y*y + z*z) if l == 0 { return vector{0, 0,...
package types type ZoneIngressTokenRequest struct { Zone string `json:"zone"` }
package goil import "testing" func Test_AvailableGroups(t *testing.T) { skipIfNoSession(t) groups, err := session.GetAvailableGroups() if err != nil { t.Fatal(err) } if len(groups) == 0 { t.Fatal("No groups returned when there should at least be one") } t.Log("These are the available groups") for id, na...
package main import ( "fmt" "testing" ) type tester struct { id int values []int } func newTesterStruct(id int, value []int) tester { t := tester{id: id, values: make([]int, len(value))} copy(t.values, value) return t } func newTesterPointer(id int, values []int) *tester { t := &tester{id: id, values: m...
/* Copyright IBM Corporation 2020 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 di...
package queries import ( "log" "github.com/jmoiron/sqlx" "gitlab.com/semestr-6/projekt-grupowy/backend/obsluga-formularzy/configuration" "gitlab.com/semestr-6/projekt-grupowy/backend/obsluga-formularzy/energy_resources/models" ) const GET_GUS_ID_SQL = ` SELECT g."GUSResourceId" ,g."GUSResourceNamePl" ,g."GU...
package rest import ( "code.huawei.com/cse/assets/consumer-gosdk/schemas/rest/service" "code.huawei.com/cse/model" "code.huawei.com/cse/route/consumer" "github.com/go-chassis/go-chassis/core/lager" "github.com/go-chassis/go-chassis/core/server" "net" "net/http" ) const Name = "http" func init() { server.Inst...
// Copyright 2019 Google LLC // // 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 ...
// simple RPC demo function which run a calculation app // exec: go run client.go -op 1 -a 10 -b 20 package main import ( "flag" "fmt" "log" "net" "github.com/zaynjarvis/fyp/rpc/protocol" ) var ( op = flag.Int64("op", 0, "operation for calculation") a = flag.Int64("a", 0, "first operand") b = flag.Int64("b...
/* Your task is to write a program, in any language, that adds two floating point numbers together WITHOUT using any fractional or floating point maths. Integer maths is allowed. Format The format for the numbers are strings containing 1's and 0's which represent the binary value of a IEEE 754 32-bit float. For exam...
/* 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, so...
// Copyright © 2018 NAME HERE <EMAIL ADDRESS> // // 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 ...
package main import ( "context" "flag" "fmt" "kafkaAPI/kafkaUtils" "os" "os/signal" "strings" "syscall" "time" "github.com/rs/zerolog/log" "github.com/segmentio/kafka-go" ) var ( // kafka kafkaBrokerURL string kafkaVerbose bool kafkaTopicIn string kafkaTopicOut string kafkaConsu...
/* chan : bidirectional chan<- send unidirectional only write <-chan recieve unidirectional only read */ package main import "fmt" func main() { ch := make(chan int, 3) processWrite(ch) processRead(ch) close(ch) } func processWrite(ch chan<- int) { ch <- 2 } func processRead(ch <-chan int) { fmt.Println(<-ch...
package action import ( "errors" "github.com/agiledragon/trans-dsl" "github.com/agiledragon/trans-dsl/test/context" ) type StubConnectServer struct { } func (this *StubConnectServer) Exec(transInfo *transdsl.TransInfo) error { stubInfo := transInfo.AppInfo.(*context.StubInfo) if stubInfo.Y == -1 { return erro...
package moxxiConf import ( "testing" "github.com/stretchr/testify/assert" ) func TestHandlerLocFlag(t *testing.T) { var testData = []string{ "/one", "/two", "three", "/four", } var expected = []string{ "/one", "/two", "/four", } testWork := new(HandlerLocFlag) for _, each := range testData {...
package demo // // #include <stdio.h> // // #include <stdlib.h> // /* // void print(char *s){ // printf("print used by C: %s\n", s); // }; // void SayHello(const char* s); // */ // import "C" // import "unsafe" // // 代码通过import "C"语句启用CGO特性,紧邻这行语句前面注释是一种特殊语法,里面包含的是正常的C语言代码。 // func main() { // s := "Hello" // cs :=...
package lib type Error struct { cause error t int msgOverride string } const ( ResourceUnreachable = iota UnsupportedContentType TransformationFailure EncodingFailure InvalidParams ) var codeMap = map[int]int{ ResourceUnreachable: 404, UnsupportedContentType: 400, TransformationFailure:...
package gt2d import ( "testing" ) func TestVector2DAdd(t *testing.T){ vector1 := Vector2D{1, 1} vector2 := Vector2D{5, 6} vector3 := vector1.Add(&vector2) if vector3.X != 6 || vector3.Y != 7 { t.FailNow() } vector1.AddIP(&vector2) if vector1.X != 6 || vector1.Y != 7 { t.FailNow() } } func TestVector2DS...
package Core type Object struct { guid GUID className string propMgr PropertyManager recordMgr RecordManager } func NewObject(guid GUID){ obj := new(Object) obj.guid = guid } func (p *Object)GetPropInt(prop string)int{ return p.propMgr.GetPropertyInt(prop) } func (p *Object) SetPropertyValue(propName string,...
package utils import ( "math/rand" "time" ) const charset string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" const idSize int = 32 const firstJan2014 = 1388534400 func GenerateToken() string { nanotime := time.Now().UTC().UnixNano() b62 := nanotimeToBaseN(nanotime, charset) rand.Seed(nano...
package collection_test import ( "bufio" "os" "strings" "testing" p2 "go.jlucktay.dev/golang-workbench/interfaces/pp2a-asg2" ) func BenchmarkSearchOAL(b *testing.B) { b.StopTimer() runSearchBenchmark(&p2.OrdArrayLinear{}, b) } func BenchmarkSearchOAB(b *testing.B) { b.StopTimer() runSearchBenchmark(&p2.Ord...
// Package parse implements parsing of the BUILD files via an embedded Python interpreter. // // The actual work here is done by an embedded PyPy instance. Various rules are built in to // the binary itself using go-bindata to embed the .py files; these are always available to // all programs which is rather nice, but ...
package controllers import ( "fmt" "github.com/kataras/iris/context" "gocherry-api-gateway/admin/models" "gocherry-api-gateway/components/utils" ) type UserSaveReq struct { UserName string `json:"user_name"` Phone string `json:"phone" validate:"required"` Pwd string `json:"pwd" validate:"required"` Le...
package main import "fmt" func main() { a := 42 fmt.Println(a) fmt.Println(&a) var b *int = &a fmt.Println(b) } // 42 // 0xc0000140b0 // 0xc0000140b0 /* The above code makes "b" pointer to memory address where an int is stored "b" is of type "int pointer" "*int" the * is part of the type b is of type "*i...
package models import ( "time" "github.com/jinzhu/gorm" ) // Coupon Model type Coupon struct { gorm.Model Code int `json:"pid" gorm:"default:0"` Name string `json:"name" gorm:"not null" binding:"required"` Desc string `json:"desc" gorm:"type:text"` ValidFr...
// Copyright 2023 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 leetcode /*Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.*/ func longestPalindrome(s string) string { res := 0 index := 0 for i := 0; i < len(s); i++ { length := maxLength(s, i, i) if length > res { res = length index = i - leng...
// Copyright © 2019 Banzai Cloud // // 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 ...
// Copyright 2018 Diego Bernardes. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package flare import ( "testing" . "github.com/smartystreets/goconvey/convey" ) func TestPaginationValid(t *testing.T) { Convey("Feature: Validate the Pa...
package sql import ( "github.com/gremlinsapps/avocado_server/dal/model" "log" ) func AutoMigrate() { conn := Connect() log.Print("AutoMigrating db.") conn.db.AutoMigrate( &dalmodel.Hashtag{}, &dalmodel.Notification{}, &dalmodel.User{}, &dalmodel.Clinic{}, &dalmodel.Chat{}, &dalmodel.Message{}, &d...
package main import ( "backend/internal/adapters/httpapi" "backend/internal/adapters/httpapi/gameapi" "backend/internal/adapters/httpapi/gamesapi" "backend/internal/adapters/httpapi/sessions" "backend/internal/adapters/httpapi/signupapi" "backend/internal/adapters/inmemoryrepo" "backend/internal/domain" "backe...
package main import "fmt" type Any interface{} type State interface { Begin(a Any) End(a Any) Update(a Any) } type Vector2 struct { x float64 y float64 } type Vector3 struct { Vector2 z float64 } type MapObject struct { Vector3 dir uint16 } const ( state_init = iota sta...
package models import "time" type Db struct { Id int `gorm:"column:id"` Name string `gorm:"column:name"` DBSchema string `gorm:"column:dbschema"` Host string `gorm:"column:host"` Username string `gorm:"column:username"` Password string `gorm:"column:password"` Port ...
package main import ( "fmt" "net/http" ) func main() { http.HandleFunc("/", foo) http.ListenAndServe(":8080", nil) } // visit http://localhost:8080?q=abc func foo(res http.ResponseWriter, req *http.Request) { q := req.FormValue("q") fmt.Fprintf(res, "Do my search: %v ?", q) }
//Incompatible function return type package main; func main () { } func pain () string { return true; }
package main import ( "bytes" "io" "log" "os" ) func cancels(x, y byte) bool { if x > y { x, y = y, x } return y-x == 32 && x >= 65 && x <= 90 } func polyLength(r io.ByteReader, lc, uc byte) int { var bs []byte var b byte var err error for b, err = r.ReadByte(); err == nil; b, err = r.ReadByte() { if ...
package main import ( "context" "flag" "fmt" "io" "log" "math/rand" pb "github.com/serhatcetinkaya/grpc-demo-app/proto/math" "time" "google.golang.org/grpc" ) var sleepTime = rand.Intn(4000) + 1000 func main() { rand.Seed(time.Now().Unix()) var host = flag.String("h", "localhost", "Address of the serv...
package http import ( "encoding/json" "fmt" "laravel-go/app/http/routes" systemLog "laravel-go/app/service/system/log" systemPolice "laravel-go/app/service/system/police" "laravel-go/pkg/libs" "net/http" "runtime" "strconv" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" ) // 实例化 HT...
package main import ( "bytes" "database/sql" "fmt" "html/template" "regexp" "sort" "strings" _ "github.com/lib/pq" // postgres "github.com/pkg/errors" ) // Queryer database/sql compatible query interface type Queryer interface { Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}...
package main import ( "fmt" ) func partition2(s string) [][]string { str := []byte(s) res := make([][]string,0) backTracking(str,[]string{},&res) return res } func backTracking(s []byte,temp []string,res *[][]string){ if len(s) == 0{ tmp := make([]string,len(temp)) copy(tmp,temp) *res = append(*res,tmp)...
package main import ( "context" "demo/grpc_test/proto/chat" "demo/grpc_test/proto/helloworld" "google.golang.org/grpc" "io" "log" "sync/atomic" "time" ) const ( address = "localhost:50051" //address = "192.168.1.201:50051" ) var ( count int64 conn *grpc.ClientConn ) func TestGreeter() { //ctx, cancel ...
package gosnowth import ( "bytes" "context" "encoding/json" "net/http" "net/http/httptest" "net/url" "strings" "testing" "time" ) const histogramTestData = `[ [ 1556290800, 300, { "+23e-004": 1, "+85e-004": 1 } ], [ 1556291100, 300, { "+22e-004": 1, "+23e-004": 2, "+30e-004"...
package main import "fmt" func main() { var what interface{} what = 100 PrintWhat(what) what = "Hippo" PrintWhat(what) } func PrintWhat(v interface{}) { fmt.Println(v) }
package ds // Word struct concern type Word struct { ID int64 EN string `json:"EN" validate:"required"` CN string `json:"CN"` } // Pagination info type Pagination struct { Page int }
package design import ( . "github.com/goadesign/goa/design" . "github.com/goadesign/goa/design/apidsl" ) var _ = Resource("version", func() { DefaultMedia(ALMVersion) BasePath("/version") Action("show", func() { Security("jwt", func() { Scope("system") }) Routing( GET(""), ) Description("Show c...
package some import ( "bufio" "fmt" "log" "net" ) func StarnEcho() { serve() } func serve() { l, err := net.Listen("tcp", ":8080") if err != nil { log.Fatal(err) } for { c, err := l.Accept() if err != nil { c.Close() continue } go handle(c) } } func handle(c net.Conn) { defer c.Close()...
package controllers import ( middleware "scholarship/middlewares" "scholarship/models" "github.com/astaxie/beego" "fmt" ) // Operations about object type ScholarshipController struct { beego.Controller } // @Title Create // @Description create object // @Param sAddr query string true "The student address" //...
// Copyright 2023 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applica...
package commands import ( "archive/zip" "encoding/json" "fmt" "os" "path" "reflect" "regexp" "strconv" "strings" "github.com/spf13/cobra" ) // ValidateCommand - validate the given platform and zip archive var ValidateCommand cobra.Command // ValidateCommand flags var zipPath string // Metadata - structur...
package benchmark import ( "context" "database/sql" "fmt" "testing" "github.com/go-gorp/gorp" "github.com/jinzhu/gorm" "github.com/jmoiron/sqlx" "xorm.io/xorm" "github.com/ulule/makroud" "github.com/ulule/makroud-benchmarks/mimic" ) func BenchmarkMakroud_Insert(b *testing.B) { exec := jetExecInsert() ex...
package gotils import ( "log" "reflect" ) /* Traverse the structs recursively allowing to modify the instances in place if required. For example - hiding or updating values selectively just before serializing to JSON. **/ type StructTraverseTraverser struct { Params map[string]interface{} } /* Interface to be ...
package sorts import ( "sort" "testing" ) func compareList(source []int, target []int) bool { if len(source) != len(target) { return false } for index := 0; index < len(source); index++ { if source[index] != target[index] { return false } } return true } func systemSort(raw []int) []int { target :...
package main import ( "os" "time" "github.com/Sirupsen/logrus" "github.com/kardianos/service" ) type letsService struct{} func (*letsService) Start(s service.Service) error { logrus.Info("Start service") return startWork() } func (*letsService) Stop(s service.Service) error { logrus.Info("Stop service") go...
package osbuild1 import ( "testing" "github.com/stretchr/testify/assert" ) func TestNewChronyStage(t *testing.T) { expectedStage := &Stage{ Name: "org.osbuild.chrony", Options: &ChronyStageOptions{}, } actualStage := NewChronyStage(&ChronyStageOptions{}) assert.Equal(t, expectedStage, actualStage) }
package config import ( "github.com/game-explorer/animal-chess-server/internal/pkg/config" "github.com/game-explorer/animal-chess-server/internal/pkg/log" "github.com/game-explorer/animal-chess-server/internal/pkg/orm" ) var App struct { // 业务Debug Debug bool `yaml:"debug"` // OrmDebug开启后会打印sql语句 OrmDebug bool...
package efclient import ( "bytes" "encoding/json" "fmt" "log" "math/rand" "net/http" "sync" "time" "github.com/nikolasMelui/go_ecommerce_faker_client/internal/app/helper" "syreclabs.com/go/faker" "syreclabs.com/go/faker/locales" ) // CounterpartyDocument ... type CounterpartyDocument struct { ID ...
package catp import ( "encoding/xml" "github.com/thought-machine/finance-messaging/iso20022" ) type Document00300102 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:catp.003.001.02 Document"` Message *ATMWithdrawalCompletionAdviceV02 `xml:"ATMWdrwlCmpltnAdvc"` } func (d *...
package config import ( "bytes" "flag" "io/ioutil" "os" "sub_account_service/app_server_v2/lib" "github.com/BurntSushi/toml" "github.com/golang/glog" ) func init() { ConfInst() } // Config 配置类型 type Config struct { Operate_timeout int // 超时时间设置 LocalAddress string // 本机地址 LocalPort string // ...
package main import ( "math/rand" "strconv" "testing" "time" "github.com/VanBur/tcp-chat/internal/message" "github.com/VanBur/tcp-chat/internal/server" "github.com/VanBur/tcp-chat/internal/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestSendReceiveMessageToSelecte...
package pg import ( // "database/sql" "fmt" . "grm-searcher/types" . "grm-service/dbcentral/pg" // "strconv" "strings" ) type MetaDB struct { MetaCentralDB } func (db MetaDB) GetTotalCountWhere(tableName, where string) int64 { var total int64 = 0 sql := fmt.Sprintf("select count(*) from %s where %s;", table...
package cli import ( "context" "io/ioutil" "os" "os/signal" "syscall" "github.com/bonedaddy/go-defi/bclient" "github.com/bonedaddy/go-defi/config" "github.com/bonedaddy/go-defi/txmatch" "github.com/urfave/cli/v2" ) func txMatchCommand() *cli.Command { return &cli.Command{ Name: "txmatch", Aliases: [...
/* https://www.careercup.com/question?id=5095457003929600 */ package fbinterview import ( "fmt" "strings" ) var ALPH_NUM = 26 // 1..26 // kw -- keyboard width // x = 1..26 // y = 0.. func PrintSentence(text string, kw int) string { cx, cy := 0, 0 x, y := 0, 0 moves := []string{} for _, r := range text { ...
package main import ( "bytes" "io/ioutil" "os" "testing" ) type MockReadKeyFile struct{ Str string } type ErrorMockReadKeyFile string func (e ErrorMockReadKeyFile) Error() string { return string(e) } func (k MockReadKeyFile) ReadFile(path string) ([]byte, error) { if path == "ok" { buf := bytes.NewBufferStri...
//package load helps the mars load redcode warriors into the core based on the // configuration. this package must: // 1) lex all supplied warriors // 2) parse and simplify all lables and expressions // 3) read config and inspect existing core // 4) return byte arrays and locations that they should be placed in the cor...
package pkg import ( "testing" "github.com/stretchr/testify/assert" ) func TestLinks(t *testing.T) { t.Run("Remove Ignored Links", func(t *testing.T) { externalLinksToIgnore, internalLinksToIgnore := []string{"github.com"}, []string{"../external_links.md"} links := Links{ Link{ AbsPath: "https://twitte...
package streamdal import ( "bytes" "testing" . "github.com/onsi/gomega" ) func TestAuthenticate(t *testing.T) { g := NewGomegaWithT(t) apiResponse := `{ "id": "8d8af58b-7d3d-474f-82ff-8b228245d159", "name": "Test User", "email": "test@streamdal.com", "onboarding_state": "", "onboarding_state_sta...
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. package shutdown import ( "net/http" ) // WrapHandler will return an http Handler // That will lock shutdown until all have completed // and will return http.StatusServiceUnavailable if // shutdown has been initiated. func WrapHandler(h...
package scache import ( "testing" "time" "github.com/stretchr/testify/require" ) func TestLruSetAndGet(t *testing.T) { cache := newShardRU(nil, newCounter(1000), newTimer(), &Config{ TTL: 1 * time.Second, }, nil) const Key = "test" cache.Set(Key, "TEST DATA1") cache.Set(Key, "TEST DATA2") val, err := ...
package main import ( "fmt" "sync" ) var x=0 var wg sync.WaitGroup var lock sync.Mutex //互斥锁 func add(){ for i:=0;i<5000;i++{ lock.Lock() x=x+1 lock.Unlock() } wg.Done() } func main(){ wg.Add(2) go add() go add() wg.Wait() fmt.Println(x) }
package main import ( "eventgo/repository" "fmt" "github.com/gin-gonic/gin" "log" "net/http" "os" "os/signal" "strconv" "syscall" ) var version Version var GitHash string var BuildTime string var GoVer string type Version struct { GitCommit string ApiVersion string GoVersion string BuildDate string }...
package string_arrage func checkInclusion(s1 string, s2 string) bool { if len(s1) > len(s2) { return false } count := map[byte]int{} toMatch := 0 for i := 0; i < len(s1); i++ { if count[s1[i]] == 0 { toMatch += 1 } count[s1[i]] += 1 } window := map[byte]int{} left, right, matched := 0, 0, 0 for ri...
/* Copyright 2022 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 mathx func MaxInt(a int, b int) int { if a >= b { return a } return b } func MinInt(a int, b int) int { if a <= b { return a } return b } func MaxInt64(a int64, b int64) int64 { if a >= b { return a } return b } func MaxFloat64(a float64, b float64) float64 { if a >= b { return a } ret...
package commands import ( "context" "strings" "github.com/docker/docker/api/types/image" "github.com/samber/lo" dockerTypes "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" "github.com/fatih/color" "github.com/jesseduffield/lazydocker/pkg/ut...
//go:build test // +build test // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. package deployment import ( "context" "encoding/json" "fmt" "log" "math/rand" "os" "os/exec" "regexp" "strconv" "time" "github.com/Azure/aks-engine/test/e2e/kubernetes/hpa" "git...
package stack import "fmt" type Browser struct { backStack *Stack forwardStack *Stack } func NewBrowser() *Browser { return &Browser{New(), New()} } func (b *Browser) Push(addr string) { b.backStack.Push(addr) } func (b *Browser) Forward() { if b.forwardStack.Len() == 0 { return } v, _ := b.forwardStac...
--- vendor/maunium.net/go/tcell/tscreen.go.orig 2022-04-12 11:45:41 UTC +++ vendor/maunium.net/go/tcell/tscreen.go @@ -50,13 +50,9 @@ const ( // $COLUMNS environment variables can be set to the actual window size, // otherwise defaults taken from the terminal database are used. func NewTerminfoScreen() (Screen, erro...
/* * EVE Swagger Interface * * An OpenAPI for EVE Online * * OpenAPI spec version: 0.4.1.dev1 * * Generated by: https://github.com/swagger-api/swagger-codegen.git */ package swagger // recipient object type PostCharactersCharacterIdMailRecipient struct { // recipient_id integer RecipientId int32 `json:"r...
package handlers import ( "encoding/json" "net/http" "time" "github.com/KARTHICK13691/go-currency/models" "github.com/gorilla/mux" "github.com/shopspring/decimal" ) // Latest /latest route controller func Latest(w http.ResponseWriter, r *http.Request) { baseParam := r.URL.Query().Get("base") symbolsParam := ...
/* Descripton: Given a typical x/y coordinate system we can plot lines. It would be interesting to know which lines intersect. Input: A series of lines from 1 to many to put in our 2-D space. The data will be in the form: (label) (x1 y1) (x2 y2) (label) will be a letter A-Z (x1 y1) will be the coordinates of the st...
package sp_test import ( "encoding/json" "fmt" "reflect" "regexp" "strings" "testing" "time" "github.com/chenyoufu/esql/sp" ) // Ensure the parser can parse strings into Statement ASTs. func TestParser_ParseStatement(t *testing.T) { // For use in various tests. now := time.Now() var tests = []struct { ...
package mymap import ( "fmt" "strconv" "sync" "testing" ) func TestInitMap(t *testing.T) { m1 := map[int]int{1: 1, 2: 4, 3: 9} t.Log(m1) t.Log(m1[0], m1[1], m1[2], m1[3]) t.Logf("len m1=%d", len(m1)) m2 := map[int]int{} m2[4] = 16 t.Logf("len m2=%d", len(m2)) m3 := make(map[int]int, 1...
// Copyright 2016 Lennart Espe. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.md file. package lib import ( "errors" "io/ioutil" "net/http" "net/url" "path/filepath" "strings" ) // Origin is a accessable data store. type Origin interface ...
package models import ( "time" ) // UserDetail : user_detailテーブルモデル type UserDetail struct { ID int64 User int64 UserName string Icon int UpdateAt time.Time }
package cmd import ( "fmt" "io" "net" "os" "github.com/google/uuid" "github.com/grandcat/zeroconf" "github.com/spf13/cobra" ) var recvCmd = &cobra.Command{ Use: "recv <id>", Short: "`recv` output over the network", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { id := ...
package dao import "TruckMonitor-Backend/model" type ContractDao interface { FindById(id int) (*model.Contract, error) FindDetails(contractId int) ([]*model.ContractDetail, error) }
package main import ( "github.com/vugu/vugu" "github.com/powerman/tr/web/app/internal/app" "github.com/powerman/tr/web/app/internal/wire" ) func vuguSetup(buildEnv *vugu.BuildEnv, eventEnv vugu.EventEnv) vugu.Builder { appl := app.New() buildEnv.SetWireFunc(func(b vugu.Builder) { if c, ok := b.(wire.ApplWire...
package day14 import ( "fmt" "math" "regexp" "strconv" "strings" "github.com/kdeberk/advent-of-code/2019/internal/utils" ) type reaction struct { product string quantity int required map[string]int } func makeReaction(product string, required int) reaction { return reaction{product, required, make(map[st...
package middleware import ( "context" "net/http" ) const _avAPIKeyHeader = "x-av-access-key" type contextKey int const _avAPIKeyContextKey = 0 // AVAPIKeymiddleware simply looks at the expected API Key header for AV products // and if an API Key is found it is placed into the context of the request func AVAPIKey...
package bo type GetJob struct { Current int `json:"current"` Size int `json:"size"` Pages int `json:"pages"` Total int `json:"total"` Orders []Order `json:"orders"` Records []*GetJobList `json:"records"` } type GetJobList struct { Id int `json:"i...
package main import ( "github.com/gallo-cedrone/fromgotok8s/src/externalservice" "github.com/magiconair/properties/assert" "io/ioutil" "net/http" "testing" "time" ) func TestMainFunction(t *testing.T) { config() server := startServer(externalservice.MockGoogleDependency{}) defer server.Shutdown(nil) time.S...
package table import ( "fmt" "io" "strconv" "strings" "time" "github.com/makkes/gitlab-cli/api" ) func pad(s string, width int) string { if width < 0 { return s } return fmt.Sprintf(fmt.Sprintf("%%-%ds", width), s) } func calcProjectColumnWidths(ps []api.Project) map[string]int { res := make(map[string]...
package main import ( "fmt" "net" "os" _ "github.com/lib/pq" "database/sql" "strconv" ) const ( CONN_HOST = "localhost" CONN_PORT = "3333" CONN_TYPE = "tcp" DB_TYPE = "postgres" DB_NAME = "testdb" // TODO change DB_USER = "postgres" DB_PSWD = "postgres" DB_HOST = ...
package main import ( github "../../github" ospaf "../../lib" ) func main() { }
package main import ( "fmt" "reflect" ) func main() { v := 3 p := &v fmt.Printf("%p\n", p) //指针变量p, 保存变量v的地址 fmt.Printf("%v\n", *p) //通过指针变量p, 访问变量v对应内存 p1 := &p fmt.Printf("%p\n", p1) //指针变量p1, 保存指针变量p的地址 fmt.Printf("%p\n", *p1) //通过指针变量p1, 访问指针变量p对应内存 fmt.Println(reflect.TypeOf(*p1)) fmt.Println(refle...
package cmd import ( "fmt" "log" "github.com/lhopki01/dirin/internal/config" "github.com/spf13/cobra" "github.com/spf13/viper" yaml "gopkg.in/yaml.v3" ) func registerCreateCmd(rootCmd *cobra.Command) { createCmd := &cobra.Command{ Use: "create <collection name>", Short: "Create a collection of directori...