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

由于根路径已更改,go测试失败

I am running go test -v $(go list ./... | grep -v /vendor/) to run all tests excluding vendor. My file structure is

myRepo
  api
    user_test.go
  config
    key.json
  main.go

I have key.json file under config folder for maintianing all api keys. I am using filepath.Abs to load key.json file. Everything is working fine except when I run tests. When I run go tests the root path is changing to myRepo/api and the error I am getting is unable to find myRepo/api/config/key.json

近期文章

  • 使用cobra命令实现Go接口
  • 如何在Go中解码加密的SSL数据包?
  • 如何将一个空结构封送为一个空数组
  • 无法使用mgo从MongoDB通过ObjectId获取数据
  • 如何在Go中检测XSS攻击并中止错误请求
  • Golang数据库管理器api概念,类型声明错误
  • 全局go-flag AddCommand的说明和/或示例
  • 在golang Webapp中处理发布请求时显示进度
  • OSX Golang静态编译,并安装gccgo
  • 从Golang中的json数组中删除特定元素
  • Docker身份验证URL的TLS自签名证书
  • SSH侦听器未关闭
  • 在Go中调试两足式OAuth2
  • Golang:处理二进制数据
  • for循环内的并发goroutines
  • 休息一下api服务器设计的好习惯
  • 使用enctype =“ multipart / form-data”将选择上传的文件的文件名传递给Golang中的struct字段
  • Gorm-与匿名字段有一种关系
  • PHP的openssl_random_pseudo_bytes替代Golang吗?
  • 使用go和Otto调用JavaScript回调函数

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华