Visual Studio Code – Golang无法识别html/template的导入。

huangapple go评论75阅读模式
英文:

Visual Studio Code - Golang does not recognize import of html/template

问题

完全不熟悉Visual Studio Code和Go语言...

尝试浏览一个代码示例,其中需要导入"html/template" -- 但是,当我尝试将"html/template"添加到导入列表时,Visual Studio Code显示如下(屏幕截图):

Visual Studio Code – Golang无法识别html/template的导入。

无论我做什么(例如:保存文件),Visual Studio Code都会删除包含"html/template"的行 -- 如何添加导入指令?

提前感谢。

英文:

Completely new to Visual Studio Code and Go ...

Trying to walk through a code sample, which requires the import of "html/template" -- however, Visual Studio Code shows the following (screen snapshot) when I try to add "html/template" to the import list:

Visual Studio Code – Golang无法识别html/template的导入。

No matter what I do, (i.e.: save the file) -- Visual Studio Code deletes the line containing "html/template" -- HOW do you add an import directive???

Thanks in advance.

答案1

得分: -1

@mkopriva - 谢谢 - 天哪 - 是的 - 我在按照教程进行操作 - 教程要求在导入列表中插入 "html/template" - 但是 - 我还没有添加任何引用该包的代码行 - 因此编辑器报错 - 这是一个会让完全新手困惑的简单问题。

英文:

@mkopriva - Thanks -- Good Grief - yes - was following the tutorial -- which asked to insert "html/template" in the import list -- BUT -- I had not yet added any lines of code that referenced that package -- hence the "error" by the editor -- something simple that would trip up a complete newbie.

huangapple
  • 本文由 发表于 2021年9月2日 23:45:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/69033396.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定