第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Golang:跨回購編譯所有測(cè)試而不執(zhí)行它們

Golang:跨回購編譯所有測(cè)試而不執(zhí)行它們

Go
汪汪一只貓 2022-12-26 10:44:59
語境我有一個(gè)回購協(xié)議,其中多個(gè)團(tuán)隊(duì)提供集成測(cè)試。所有這些測(cè)試都隱藏在//go:build integration標(biāo)志后面,所以如果我想go查看或運(yùn)行它們,我需要將-build integration標(biāo)志傳遞給測(cè)試命令。目的我想要完成的是編譯整個(gè) repo 中的所有測(cè)試而不實(shí)際執(zhí)行它們(將花費(fèi)很長(zhǎng)時(shí)間),這樣我就可以捕獲由 PR 引入的默認(rèn)go test編譯和執(zhí)行不會(huì)捕獲的構(gòu)建錯(cuò)誤。我看到了-c旗幟:-c 將測(cè)試二進(jìn)制文件編譯為 pkg.test 但不運(yùn)行它(其中 pkg 是包導(dǎo)入路徑的最后一個(gè)元素)??梢允褂?-o 標(biāo)志更改文件名。但是......不能將-c標(biāo)志與標(biāo)志一起使用-build:$ go test -build=integration -c ./integrationtests/client/admin-apigo: 未知標(biāo)志 -build=integration 不能與 -c 一起使用另外...不能-c在多個(gè)包中使用該標(biāo)志:$ 去測(cè)試-c ./...不能對(duì)多個(gè)包使用 -c 標(biāo)志有任何想法嗎?
查看完整描述

1 回答

?
湖上湖

TA貢獻(xiàn)2003條經(jīng)驗(yàn) 獲得超2個(gè)贊

您可以使用go test -run標(biāo)志并將其傳遞給您知道永遠(yuǎn)不會(huì)匹配的模式:


go test -run=XXX_SHOULD_NEVER_MATCH_XXX ./...


ok      mypkg       0.731s [no tests to run]

這將捕獲任何測(cè)試編譯錯(cuò)誤——如果沒有——?jiǎng)t不會(huì)運(yùn)行任何測(cè)試。


如果您需要傳遞通常在您的go build過程中傳遞的任何構(gòu)建標(biāo)記(例如go build -tags mytag),您可以在以下過程中執(zhí)行相同的操作go test:


go test -tags mytag -run=XXX_SHOULD_NEVER_MATCH_XXX ./...

-run內(nèi)聯(lián) ( go help testflag) 文檔中有關(guān)標(biāo)志的完整詳細(xì)信息:


        -run regexp

            Run only those tests, examples, and fuzz tests matching the regular

            expression. For tests, the regular expression is split by unbracketed

            slash (/) characters into a sequence of regular expressions, and each

            part of a tests identifier must match the corresponding element in

            the sequence, if any. Note that possible parents of matches are

            run too, so that -run=X/Y matches and runs and reports the result

            of all tests matching X, even those without sub-tests matching Y,

            because it must run them to look for those sub-tests.


查看完整回答
反對(duì) 回復(fù) 2022-12-26
  • 1 回答
  • 0 關(guān)注
  • 91 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)