我在本教程中使用Go模块设置了一个新项目,然后尝试构建它。
该模块位于$ GOPATH外部的文件夹中,其结构如下:
example.com
??? my-project
??? ??? main
??? ??? ??? main.go
??? ??? go.mod
Run Code Online (Sandbox Code Playgroud)
我已经go mod init example.com/my-project在目录中运行example.com/my-project并创建了上面显示的go.mod文件。
main.go 基本内容:
example.com
??? my-project
??? ??? main
??? ??? ??? main.go
??? ??? go.mod
Run Code Online (Sandbox Code Playgroud)
尝试go build在directory中运行后example.com/my-project,收到以下错误消息:
can't load package: package example.com/my-project: unknown import path "example.com/my-project": cannot find module providing package example.com/my-project。
我也尝试go build在/之外的目录中运行example.com/my-project,但得到类似的失败结果:
can't load package: package .: no Go files in …
如何在 Common Lisp 中通过分隔符拆分字符串,就像在 SPLIT-SEQUENCE 中所做的那样,但还要在字符串列表中添加分隔符?
例如,我可以写:
(split-string-with-delimiter #\. "a.bc.def.com")
结果是("a" "." "bc" "." "def" "." "com").
我试过下面的代码(make-adjustable-string制作一个可以用 扩展的字符串vector-push-extend):
(defun make-adjustable-string (s)
(make-array (length s)
:fill-pointer (length s)
:adjustable t
:initial-contents s
:element-type (array-element-type s)))
(defun split-str (string &key (delimiter #\ ) (keep-delimiters nil))
"Splits a string into a list of strings, with the delimiter still
in the resulting list."
(let ((words nil)
(current-word (make-adjustable-string "")))
(do* ((i 0 (+ i 1))
(x (char …Run Code Online (Sandbox Code Playgroud) 我可以使用什么代码,以便我的golang程序可以打开一个新的控制台窗口?
我有一个程序A正在运行程序B,因此程序B没有控制台窗口(stdin和stdout用于与程序A交互).我希望程序B在新的控制台窗口(以及程序A的控制台窗口)中显示用户友好的信息,以便很容易看到正在发生的事情.