golang test

5-02 2,121 views

文件命名格式为 xxx_test.go 如 object_test.go

package test

import (
    "fmt"
    "testing"
)

func TestObject(t *testing.T) {
    fmt.Println("hello")
    t.Fail()
}

测试单个文件,一定要带上被测试的原文件

Go test -v  wechat_test.go wechat.go

测试单个方法

go test -v -test.run TestRefreshAccessToken

How can I host my public package on my personal domain?

<blockquote class="reddit-card" > <a href="https://www.reddit.com/r/golang/comments/mn2zsa/how_can_i_host_my_public_package_on_my_pe...

阅读全文

golang skia demo

skia build 1. 下载安装 depot_tools git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' export PATH="${PWD}/depot_tools:${...

阅读全文

Go 语言编译器的 “//go:” 详解

前言 C 语言的 #include 一上来不太好说明白 Go 语言里 //go: 是什么,我们先来看下非常简单,也是几乎每个写代码的人都知道的东西:C 语言的 #include。 我...

阅读全文

欢迎留言