我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

无法参考我自己的包裹

I have created an interface as well as a struct, but every time I save my Go file, the compiler is formatting away my import statement and indicating that my struct is undefined.

I'm totally new to Go, so this probably seems obvious to someone. I've read the documentation.

Here's my file structure: enter image description here

How do I properly reference a type I've created?

You have to qualify a name when it's coming from another package. Try models.HttpResult in the file on the left.

近期文章

  • Go函数可以指定特定的数组长度吗?
  • Golang拆分并将字符串解析为不同的类型
  • 如何在go中使用os.Name()?
  • 去包装进口问题
  • 初始化方法中返回指针和值之间的区别
  • 使用go run的路径不适用于go install /从bin调用可执行文件
  • 使用Go签署的Hmac / sha1消息与node.js或Python的结果不同
  • 具有相同golang代码段的巨大性能差异查询mysql数据库
  • 为什么http处理程序的参数似乎将其指针向后移动? [重复]
  • golang:我可以将辅助函数应用于返回的参数之一
  • 为什么是“ err!= nil”? [重复]
  • 在Go中用格式说明符声明变量
  • 在golang中打开一个网址,然后阅读重定向的网址
  • Go中的结构初始化和方法声明
  • 为什么Go将字节添加到我的字符串中?
  • 解码JSON响应时遇到问题[重复]
  • 转到Paypal REST API请求
  • 无法构建简单的golang代码-切片文字语法
  • RESTFUL API中的golang结构或地图
  • <nil>在golang中解析xml字符串时

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华