text
stringlengths
11
4.05M
package main import ( "fmt" "os" ) var smr stumanager //菜单函数 func showmenu(){ fmt.Println("欢迎来到管理系统!!") fmt.Println(` 1.查看所有学生 2.添加学生 3.修改学生 4.删除学生 5.退出 `) } func main(){ smr=stumanager{ //修改全局变量的那个变量 allstudent: make(map[int64]student,100), } for{ showmenu() //等待用户输入选项 var cho...
package paperswithcode_go import ( "fmt" "github.com/codingpot/paperswithcode-go/v2/models" ) // PaperGet returns a single paper. Note that paperID is hyphen cased (e.g., generative-adversarial-networks). func (c *Client) PaperGet(paperID string) (*models.Paper, error) { paperGetURL := fmt.Sprintf("%s/papers/%s/",...
package libstring import ( "encoding/json" "math" "strings" "unicode" ) // JSONEncode - Encode JSON without escape HTML func JSONEncode(data interface{}) string { bt, _ := json.Marshal(data) return string(bt) } // Ucfirst - Upper case first character func Ucfirst(str string) string { for _, v := range str { ...
package errors import ( "errors" "fmt" "github.com/rokmetro/logging-library/logutils" ) //ErrorContext represents the context of an error message type ErrorContext struct { message string function string } //String converts the ErrorContext to a string func (e ErrorContext) String() string { if e.function !=...
package main import ( "fmt" "io" "log" "net/http" "os" "github.com/gorilla/mux" ) // WriteToFile will print any string of text to a file safely by // checking for errors and syncing at the end. func WriteToFile(filename string, data string) error { file, err := os.Create(filename) if err != nil { return er...
package main //スコープ import ( "fmt" //別名指定 //f"fmt" //省略して書ける(非推奨) //."fmt" //本来は絶対パスで指定 "./foo" ) func appName() string { const AppName = "GoApp" var Version string = "1.0" return AppName + " " + Version } func Do(s string) (b string) { //var b string = s b = s { b := "BBBB" fmt.Println(b) } retu...
package usecase import ( "fmt" "net/http" "strconv" "strings" "time" entity "silverfish/silverfish/entity" "github.com/PuerkitoBio/goquery" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) // FetcherCartoonmad export type FetcherCartoonmad struct { Fetcher } // NewFetcherCartoonmad export func NewF...
package mocks import client "github.com/quilt/quilt/api/client" import mock "github.com/stretchr/testify/mock" // Getter is an autogenerated mock type for the Getter type type Getter struct { mock.Mock } // Client provides a mock function with given fields: _a0 func (_m *Getter) Client(_a0 string) (client.Client, e...
package svg type Command struct { C Cmd Style map[string]string } type Cmd uint const ( SVG Cmd = iota A ALT_GLYPH ALT_GLYPH_DEF ALT_GLYPH_ITEM ANIMATE ANIMATE_COLOR ANIMATE_MOTION ANIMATE_TRANSFORM CIRCLE CLIP_PATH COLOR_PROFILE CURSOR DEFS DESC ELLIPSE FE_BLEND FE_COLOR_MATRIX FE_COMPONENT...
// Copyright 2019 The Dice Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by app...
package main import "github.com/sanguohot/medichain/contracts" func main() { //contracts.DeployEasyCns(false) contracts.DeployAllByDefaultEasyCnsAddress(false) }
// Copyright (C) 2015 Scaleway. 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 commands import ( "fmt" "github.com/sirupsen/logrus" ) // RmiArgs are flags for the `RunRmi` function type RmiArgs struct { Identifier []string /...
package riak import ( "testing" ) func BenchmarkStoreObject(b *testing.B) { client := New("127.0.0.1:8087") err := client.Connect() if err != nil { b.FailNow() } for i := 0; i < b.N; i++ { bucket, err := client.Bucket("client_test.go") if err != nil { b.FailNow() } obj := bucket.New("abc", PW1, DW...
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. package api import ( "encoding/json" "os" "reflect" "github.com/Azure/aks-engine/pkg/api/vlabs" "github.com/Azure/aks-engine/pkg/helpers" "github.com/Azure/aks-engine/pkg/i18n" ) const ( defaultOrchestrator = Kub...
package auditor import ( "context" "time" "github.com/pkg/errors" "github.com/MagalixCorp/magalix-agent/v3/agent" "github.com/MagalixCorp/magalix-agent/v3/entities" "github.com/MagalixCorp/magalix-agent/v3/kuber" "github.com/MagalixTechnologies/core/logger" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"...
package main import ( "flag" "fmt" "github.com/climber73/tendermint-challenge/worldx" "os" ) func main() { n := flag.Int("n", 2, "number of aliens") path := flag.String("path", "", "path to map file") flag.Parse() if len(*path) == 0 { exit(fmt.Errorf("empty path")) } file, err := os.Open(*path) if err ...
package main import "fmt" func foo(y *int) { fmt.Println(y) *y = 43 } func main() { x := 0 foo(&x) fmt.Println(x) }
package view import ( "log" "net/http" "go.sancus.dev/cms" "go.sancus.dev/web/errors" ) var ErrNotImplemented = &errors.HandlerError{ Code: http.StatusServiceUnavailable, } type DirectoryHandler struct { d cms.Directory v *View } func (h DirectoryHandler) TryServeHTTP(w http.ResponseWriter, r *http.Request)...
package main import ( "bufio" "flag" "fmt" "log" "os" "strings" "golang.org/x/crypto/ssh" ) var ( user = flag.String("u", "login", "User name") password = flag.String("pwd", "pass", "Password") host = flag.String("h", "host", "Host") port = flag.String("p", "22", "Port") ) var client *ssh.Cli...
package levm import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/params" vmi "github.com/cryptokass/levm/vminterface" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/vm" "github.com/et...
package main import "time" //User to document type User struct { ID int `json:"id"` FirstName string `json:"firstName"` LastName string `json:"lastName"` DateOfBirth time.Time `json:"dateOfBirth"` LocationOfBirth string `json:"locationOfBirth"` } // Database implemen...
package shared import ( "context" "memoapp/internal/database" "memoapp/model" ) type ( Middleware interface { Get() ([]byte, error) Set(*model.Memo) ([]byte, error) SetByte([]byte) error DEL(int) ([]byte, error) } MiddlewareInfo struct { Context context.Context Client database.Client Next Mid...
package main import ( "fmt" "math" ) type Circle struct { x, y, r float64 } type Rectangle struct { x1, y1, x2, y2 float64 } func (r *Rectangle) area() float64 { l := distance(r.x1, r.y1, r.x1, r.y2) w := distance(r.x1, r.y1, r.x2, r.y1) return l * w } // ฟังก์ชันแบบพิเศษ /* สร้าง method ให้ structs ด้วยการป...
package middle import ( "os" "runtime" "io/ioutil" "path/filepath" ) // BrowserLocation represents a location in the browser VFS. type BrowserLocation struct { // Location is the actual path (should be passable to file IO functions if not virtual) Location string // Dir is true if this is a directory, false ot...
package ctxutil import ( "net/http" "github.com/go-chi/chi/middleware" ) // Key is a useful type for denoting context keys type Key string // GetRequestID gets ID key func GetRequestID(r *http.Request) (requestID string) { if reqID := r.Context().Value(middleware.RequestIDKey); reqID != nil { requestID = reqID...
package server import ( "encoding/json" "fmt" "net/http" "net/url" "github.com/bryanl/dolb/service" "github.com/gorilla/mux" ) func ServiceCreateHandler(c interface{}, r *http.Request) service.Response { config := c.(*Config) vars := mux.Vars(r) lbID := vars["lb_id"] lb, err := config.DBSession.LoadLoadB...
package k8sutil import ( "fmt" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" ) // InClusterClient gets a kubernetes client with an in-cluster configuration. func InClusterClient() (*kubernetes.Clientset, error) { kconf, err := rest.InClusterConfig() if err != nil { return nil, fmt.Errorf("failed to ge...
package slog import ( "fmt" "os" "testing" "time" ) func TestGetLoggerToReturnNotNilLogger(t *testing.T) { // arrange // act logger, e := GetLogger("AnyLog") // assert if e != nil { t.Fatalf("Expected error == Nil but got '%s'", e.Error()) } if logger == nil { t.Fatalf("Expected LogHandler != Nil bu...
// DRUNKWATER TEMPLATE(add description and prototypes) // Question Title and Description on leetcode.com // Function Declaration and Function Prototypes on leetcode.com //295. Find Median from Data Stream //Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value....
package piscine import "github.com/01-edu/z01" func PrintStr(str string) { for _, z := range str { z01.PrintRune(rune(z)) } }
package main import "fmt" func getDurationText(seconds int) string { if seconds < 60 { return fmt.Sprintf("%dsec", seconds) } else if seconds < 60*60 { minutes := seconds / 60 seconds = seconds % 60 return fmt.Sprintf("%dm%02dsec", minutes, seconds) } else { hours := seconds / (60 * 60) minutes := (sec...
package main import ( "encoding/base64" "fmt" "net/http" "net/http/httptest" "testing" ) var fakeFSHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "fs") }) func TestValidBasicAuth(t *testing.T) { creds = &AuthCreds{ Username: "test", Password: "want12345", } var te...
package routers import ( "github.com/gin-gonic/gin" "personnelMS-server/app/Controllers/Api" ) func InitRouter() *gin.Engine { r := gin.New() r.Use(gin.Logger()) r.Use(gin.Recovery()) api := r.Group("/api") { api.GET("/index", Api.Index) } return r }
package pg import ( "github.com/kyleconroy/sqlc/internal/sql/ast" ) type RangeTableFunc struct { Lateral bool Docexpr ast.Node Rowexpr ast.Node Namespaces *ast.List Columns *ast.List Alias *Alias Location int } func (n *RangeTableFunc) Pos() int { return n.Location }
package main import ( "context" "log" "github.com/tuanda/unary/unarypb" "google.golang.org/grpc" ) func main() { cc, err := grpc.Dial("localhost:50069", grpc.WithInsecure()) if err != nil { log.Fatalf(" err while dial %v", err) } defer cc.Close() client := unarypb.NewCalculatorServiceClient(cc) log.Pr...
package websocket_service import ( "ms/sun/servises/log_service" ) const PB_ResponseToClient = "PB_ResponseToClient" var logPipes = log_service.NewSimpleLoggerWithExtension("pipe", ".gol") var logRpc = log_service.NewSimpleLoggerWithExtension("rpc", ".gol") var logHttpRpc = log_service.NewSimpleLoggerWithExtension(...
package goose import ( "fmt" "runtime" "time" ) var ( targetDriver = DriverSDL2 targetFPS = 60 ) // Run starts the main game loop of the Goose engine using the Update and Draw // methods provided by the given Game object. func Run(game Game) error { runtime.LockOSThread() if game == nil { game = &default...
/* * @lc app=leetcode.cn id=18 lang=golang * * [18] 四数之和 */ package solution import "sort" // @lc code=start func fourSum(nums []int, target int) (ans [][]int) { counter := map[int]int{} for _, num := range nums { counter[num]++ } unique := []int{} for key := range counter { unique = append(unique, key...
package coda import ( "fmt" "github.com/stretchr/testify/assert" "testing" ) func TestDeletePermission(t *testing.T) { docId := "fakeDoc" permission := "fakePermission" expectedPath := fmt.Sprintf("/docs/%s/acl/permissions/%s", docId, permission) server := buildTestServer(expectedPath, "test_data/delete_permis...
package dochead import ( "testing" ) func assertEquals(t *testing.T, value, expected, name string) { if value != expected { t.Errorf("api resource %s \"%s\" does not match \"%s\"", name, value, expected) } } func TestMarkdown(t *testing.T) { file := "./parser_test.ogdl" apiResources, _ :...
package wordy import "strings" import "strconv" const testVersion = 1 // Parse and evaluate simple math word problems returning the answer as an integer. // input: What is 5 plus 13? // return 18 // if not valid question, then return false func Answer(question string) (int, bool) { question = strings.TrimSuffix(que...
package main import ( "testing" "github.com/jackytck/projecteuler/tools" ) func TestP95(t *testing.T) { cases := []tools.TestCase{ {In: 1000000, Out: 14316}, } tools.TestIntInt(t, cases, solve, "P95") }
// Package bind is for modular binding of mix to audio interface package bind import ( "testing" "github.com/stretchr/testify/assert" "github.com/go-mix/mix/bind/opt" ) func TestAPI(t *testing.T) { // TODO } func TestAPI_UseWAV(t *testing.T) { UseLoader(opt.InputWAV) assert.Equal(t, opt.InputWAV, useLoader) ...
package main // List of function that computer can do type computerTemplate interface { Booting() string ShutDown() string } // Computer as a concrete class type Computer struct{} // Booting define what is booting, this is a concrete function func (c *Computer) Booting() string { return "Starting computer..." } ...
package UserPostgres import ( "MainApplication/config" "MainApplication/internal/User/UserModel" "MainApplication/internal/User/UserRepository" crypto "crypto/rand" "fmt" "github.com/go-pg/pg/v9" pgwrapper "gitlab.com/slax0rr/go-pg-wrapper" "golang.org/x/crypto/bcrypt" "math/big" ) type dataBase struct { DB...
package main import ( "fmt" "strings" //"github.com/WangJiemin/gocomm/json" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm" ) var DB *gorm.DB type InForMation_All_5e619c69 struct { ID int Title string } func (InForMation_All_5e619c69) TableName() string { return "information_all_5e619c69" } ...
package marathon import "fmt" type Client struct { config *Config } // Config represents the marathon client configuration object type Config struct { HTTPBasicAuthUser string HTTPBasicAuthPassword string DCOSToken string URI string } // NewClient instantiates a new marathon c...
package con const ( XML_REP = `<?xml version="1.0"?><cross-domain-policy><allow-access-from domain="*" to-ports="13603,13604"/></cross-domain-policy>` OK = 0 FL = 1 ROLE_LEVEL = 100 )
// Copyright (c) 2016, M Bogus. // This source file is part of the AMQP-RPC open source project // Licensed under Apache License v2.0 // See LICENSE file for license information package amqprpc import ( "fmt" "reflect" ) var ( invokers = make(map[string]interface{}) funcArgs = make(map[string][]string) ) // Ali...
package main import ( "fmt" "runtime" "time" ) /** 控制流、条件跳转语句、goroutine的测试 */ func main() { var heads, tails int switch coinFlip() { case "heads": heads++ case "tails": tails++ default: fmt.Println("") } fmt.Println(heads) //测试管道队列,用于在线程间传输值 //var ch=make(chan string) go printf() //阻塞主线程 否则...
package options type BaseDecls struct { unexportedEmptyVal struct{} ChanVal chan struct{} MapVal map[string]interface{} SliceVal []int UnnamedFunctionVal func() AnyIface interface{} StaredVal *[]*[]*[]*[]********map[*int]*int }
package getToken import ( "fmt" "github.com/labstack/echo" "net/http" ) func RouterGetToken(c echo.Context) error { //temp := model.ResponseCommand{} fmt.Println("masuk ke router") username := c.FormValue("username") password := c.FormValue("password") resp := GetToken(username, password) fmt.Println("Respon...
package webserver import ( "net/http" "github.com/vitalyisaev2/buildgraph/common" ) type Webserver interface { common.Service GitlabPushEvent(http.ResponseWriter, *http.Request) }
// +build it package main import ( "bytes" "encoding/json" "fmt" "log" "net/http" "os" "strings" "testing" "time" "github.com/TempleEight/spec-golang/match/comm" "github.com/TempleEight/spec-golang/match/dao" "github.com/TempleEight/spec-golang/match/util" "github.com/google/uuid" ) var environment env...
package day16 import ( "errors" "strconv" ) func ParseInt(input string) (int, error) { num, err := strconv.Atoi(input) if err != nil { return 0, errors.New("Bad String") } return num, nil }
package cli import ( "context" "flag" ) // Command is the interface that holds command execution logic. type Command interface { Run(ctx context.Context, args []string) error } // CommandFunc is an adapter to allow the use of ordinary functions as // Commands. type CommandFunc func(ctx context.Context, args []str...
package darwin import ( "github.com/lunixbochs/argjoy" co "github.com/lunixbochs/usercorn/go/kernel/common" ) func Unpack(k co.Kernel, arg interface{}, vals []interface{}) error { return argjoy.NoMatch } func registerUnpack(d *DarwinKernel) { d.Argjoy.Register(func(arg interface{}, vals []interface{}) error { ...
package system import ( "os" "testing" ) // TestGetwd 获取工作目录 func TestGetwd(t *testing.T) { if dir, err := os.Getwd(); err == nil { t.Log(dir) } else { t.Error(err) } }
package display import ( "strconv" "github.com/GoAdminGroup/go-admin/modules/utils" "github.com/GoAdminGroup/go-admin/template/types" ) type FileSize struct { types.BaseDisplayFnGenerator } func init() { types.RegisterDisplayFnGenerator("filesize", new(FileSize)) } func (f *FileSize) Get(args ...interface{}) ...
package solutions import ( "fmt" "testing" ) func TestIsValid(t *testing.T) { t.Run("Test isValid", func(t *testing.T) { var tests = []struct { input string want bool }{ {"()", true}, {"(]", false}, {"()[]{}", true}, {"([)]", false}, {"()()", true}, {"(())([])", true}, {"(", false},...
package event import ( "github.com/serverless/event-gateway/function" ) // SystemEventReceivedType is a system event emitted when the Event Gateway receives an event. const SystemEventReceivedType = TypeName("eventgateway.event.received") // SystemEventReceivedData struct. type SystemEventReceivedData struct { Pat...
package v1 import ( "blog/app/models" "blog/app/repositories" "blog/app/web/responses/admin" "blog/app/web/services" "github.com/kataras/iris/v12" "github.com/mlogclub/simple" ) type SystemConfigController struct { Ctx iris.Context SystemConfigRepository *repositories.SystemConfigRepository...
package validatorimpl import ( "fmt" "reflect" "strconv" ) //DefaultValidator will validate below tag: // required: boolean <-- The field could not be empty. // TBD: More default validators type DefaultValidator struct{} // Verify returns empty error list if validate successfully. func (dv DefaultValidator)...
package util import ( "fmt" "math" "net/url" ) type Pagination struct { Uri string Params map[string]string Page int Size int Total int MaxPage int Pages []int Prev int Next int FirstPage int LastPage int } func NewPagination(uri string, page, size, total int, pa...
package ctrls import ( "github.com/gin-gonic/gin" "github.com/stetsd/blo-go/renderer" ) func Forbidden(c *gin.Context) { renderer.Render(c, gin.H{}, "forbidden.html") }
package main import ( "fmt" "sync/atomic" "unsafe" ) type Struct struct { p unsafe.Pointer // some pointer } func main() { data := 1 info := Struct{p: unsafe.Pointer(&data)} fmt.Printf("info is %d\n", *(*int)(info.p)) otherData := 2 atomic.StorePointer(&info.p, unsafe.Pointer(&otherData)) fmt.Printf("...
// +build prometheus // Package metrics contains support for reporting metrics to an external server, // currently a Prometheus pushgateway. Because plz runs as a transient process // we can't wait around for Prometheus to call us, we've got to push to them. package metrics import ( "fmt" "os/user" "runtime" "str...
package main import ( "flag" "fmt" "io" "math/rand" "os" "path" "time" ) var ( fCon = flag.Int("c", 10, "") fNum = flag.Int("n", 8, "") fShow = flag.Int("s", 3000, "") fPath = flag.String("p", "/data4/foo", "") fFiles = flag.Int("f", 5, "") fSeek = flag.Bool("seek", true, "") fwq = flag.Int("w...
package tasks import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" "time" ) type FakeTester struct { TaskCalledCount int } var _ = Describe("PeriodicTask", func() { Describe("#Task", func() { It("should call FakeTester's Task", func() { f := FakeTester{} t := PeriodicTask{ Task:...
/* * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obta...
package networking import ( "gotrading/core" ) type Batch struct { } type orderbooksFetched func(orderbooks []*core.Orderbook) type ordersPosted func(orders []core.OrderDispatched) type sortedOrderbook struct { Index int Orderbook *core.Orderbook } type sortedOrder struct { Index int OrderDispa...
package http import ( "log" "github.com/jinzhu/gorm" "github.com/miRemid/mio" "github.com/miRemid/mioqq" "github.com/miRemid/mioqq/http/config" ) const ( // NoticeHandler = = NoticeHandler = iota // RequestHandler 请求处理函数 RequestHandler ) const ( message = "message" notice = "notice" request = "request"...
package terminfo var linux = Terminfo{ Name: "linux", Keys: [maxKeys]string{ "", "\x1b[[A", "\x1b[[B", "\x1b[[C", "\x1b[[D", "\x1b[[E", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1...
//this package is responsible for handling tasks. package task import ( log "code.google.com/p/log4go" "github.com/d-d-j/ddj_master/common" "github.com/d-d-j/ddj_master/dto" "github.com/d-d-j/ddj_master/node" "time" ) //Balancer is responsible for dispaching task to different worker and taking care of sending no...
package main // QuickUnion - Union operation is quick and Find operation is expensive // Array stores the direct parent of the object // QuickUnion ... type QuickUnion struct { id []int } // New ... func New(n int) *QuickUnion { return &QuickUnion{ id: make([]int, n), } } // Init ... func (qu *QuickUnion) Init...
package pdl import ( "encoding/json" "testing" ) func TestNewFileData(t *testing.T) { file := NewFileData(nil) err := file.OpenFile("/Users/ytx/mx/mny3/github.com/go-xe2/xthrift/pdl/proto/com/mnyun/reg/user/regUserSvc.yaml") if err != nil { t.Fatal(err) } bytes, err := json.MarshalIndent(file, "", " ") if e...
package main import "fmt" func main() { var num = 10 if num == 10 { fmt.Println("hello == 10") } else if(num > 10) { fmt.Println("hello > 10") } else { fmt.Println("hello < 10") } if num2:= 10; num2>=10 { fmt.Println("hello >=10") } for i := 0; i < 10; i++ { fmt.Printf("%v ", i+1) } // 打印所有的偶数 ...
package models import ( "errors" "fmt" ) var ( ErrMissingFormData = &apiErr{ code: 400, message: "Missing fields in input data", } ErrUploadFailed = &apiErr{ code: 500, message: "Upload failed", } ErrUploadInvalidFile = &apiErr{ code: 400, message: "Unable to read uploaded file", } ErrDo...
// Copyright (c) 2020 Hirotsuna Mizuno. All rights reserved. // Use of this source code is governed by the MIT license that can be found in // the LICENSE file. package speedio import ( "io" "sync" "time" "github.com/tunabay/go-infounit" ) // MeterReader implements bit rate measurement for an io.Reader object. ...
package xhdiagnose import ( "net/http" _ "net/http/pprof" "strings" ) // StartPPROF 启动pprof诊断功能 // addr,一般采用127.0.0.1:port func StartPPROF(enable bool, addr string) { if enable { if strings.Contains(addr, ":") { go func() { _ = http.ListenAndServe(addr, nil) }() } else { go func() { _ = http....
package httputil import ( "errors" "math" "net/http" "net/http/httptest" "testing" "github.com/google/go-cmp/cmp" ) func TestRedirect(t *testing.T) { t.Parallel() tests := []struct { name string method string url string code int wantStatus int }{ {"good", http.MethodGet, "https://pomerium.i...
package greeter import ( "github.com/hashrs/blockchain/chain/x/greeter/internal/keeper" "github.com/hashrs/blockchain/chain/x/greeter/internal/types" ) const ( ModuleName = types.ModuleName RouterKey = types.RouterKey StoreKey = types.StoreKey ) var ( NewKeeper = keeper.NewKeeper NewQuerier = keeper.New...
package req /* ToUserName 开发者微信号 FromUserName 发送方帐号(一个OpenID) CreateTime 消息创建时间 (整型) MsgType 语音为voice MediaId 语音消息媒体id,可以调用获取临时素材接口拉取数据。 Format 语音格式,如amr,speex等 MsgId 消息id,64位整型 */ type Voice struct { ToUserName string `json:"to_user_name"` FromUserName string `json:"from_user_name"` CreateTime int64 `json:"cr...
/* twitter@hector_gool */ package main import "fmt" func main() { s := make([]int, 3) fmt.Printf("el slice es: %d \n", s) s[0] = 1 s[1] = 2 s[2] = 3 fmt.Printf("el slice es: %d \n", s) s = append(s, 4,5,6,10) fmt.Printf("el slice es: %d \n", s) fmt.Printf("el tamaño del slice es: %d \n", len(s)) f...
package jetcd const EtcdUrl = "192.168.33.10:2379"
package day10 import ( "testing" ) const part1Answer = 303 const part2Answer = 408 func TestPart1(t *testing.T) { asteroids, err := readAsteroids("../../input/10.txt") if err != nil { t.Fatal("Could not read asteroids", err) } answer := part1(asteroids) if part1Answer != answer { t.Errorf("part1(input) ==...
/* * Update an existing Account Policy. */ package main import ( "flag" "fmt" "os" "path" "strings" "github.com/grrtrr/clcv2/clcv2cli" "github.com/grrtrr/exit" "github.com/olekukonko/tablewriter" ) func main() { var intvl = flag.Duration("freq", 0, "Backup interval (time duration between backups") var ex...
package sum import ( "testing" "lib" ) func TestSum(t *testing.T) { t.Run("add all the elements of the array", func(t *testing.T) { lib.AssertEqualIntegers(t, Sum([]int{1, 2, 3, 4, 5}), 15) }) } func TestSumAll(t *testing.T) { t.Run("Return sum of each slice as an item in the slice", func(t *testing.T) { li...
/* 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...
package proxy import ( "errors" "flag" "fmt" ss "github.com/shadowsocks/shadowsocks-go/shadowsocks" "log" "net" "net/url" "os" ) // shadowsocks parent proxy type shadowsocksParent struct { server string method string // method and passwd are for upgrade config passwd string cipher *ss.Cipher } type shado...
package main import ( "errors" "github.com/gin-gonic/gin" "encoding/json" ) //region Autos requests type AutosLearningRequest struct { BaseLearningRequest Targets []AutosPoint Data []AutosPoint } func (g *AutosLearningRequest) ReceiveRequest (c *gin.Context) error { jsonDecodeErr := json.NewDecoder(c.Request...
package testdata import ( "github.com/frk/gosql" "github.com/frk/gosql/internal/testdata/common" ) type InsertReturningAfterScanSingleQuery struct { User *common.User2 `rel:"test_user:u"` _ gosql.Return `sql:"*"` }
package main import ( "flag" "fmt" "gopkg.in/yaml.v2" "io/ioutil" "log" "os" ) func main() { sigs := make(chan os.Signal, 1) done := make(chan bool, 1) go func() { sig := <-sigs fmt.Println() fmt.Println(sig) done <- true }() filename := flag.String("config", "config.yml", "Path to config file") g...
package models import ( "github.com/astaxie/beego/orm" "time" ) // 销售记录 type Sales struct { SalesID int64 `orm:"pk;auto"` CardNum string GoodsID int64 GoodsName string JiaGE int TiJian string Ewai string Tiyan string CreateDate time.Time `orm:"auto_now_add;type(datet...
package decoder import "github.com/etf1/kafka-message-scheduler/schedule" type Decoder interface { Decode(s schedule.Schedule) (schedule.Schedule, error) }
package usergroup import ( "github.com/hardstylez72/bblog/ad/pkg/group" ) type Group group.Group
/* * AppManager API * * HTTP REST API to connect to the AppManager * * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package appManagerApiClient import core "k8s.io/api/core/v1" type Pods struct { Annotations map[string]string `json:"a...
package simplegfs import ( "net/rpc" "time" ) const FilePermRW = 0666 const FilePermRWX = 0777 const ChunkSize = 64 * (1 << 20) const HeartbeatInterval = 100 * time.Millisecond const CacheTimeout = time.Minute const CacheGCInterval = time.Minute const AppendSize = ChunkSize / 4 // ChunkServer lease related const...
package templates import ( "glsamaker/pkg/app/handler/authentication/utils" "glsamaker/pkg/models" "glsamaker/pkg/models/users" "html/template" "net/http" ) // renderIndexTemplate renders all templates used for the login page func RenderAccessDeniedTemplate(w http.ResponseWriter, r *http.Request) { user := uti...
package smarttv import ( "fmt" "github.com/Jeffail/gabs" "io/ioutil" "os" "reflect" "strings" ) func checkErr(err error) { if err != nil { panic(err) } } func checkError(e error) (empty string, err error) { if e != nil { return } return } func parseJson(fileName string) *gabs.Container { jsonFile...