go

No test coverage when tests are in a different package

别等时光非礼了梦想. 提交于 2020-11-27 17:13:53
问题 I have integration tests which are located in a separate directory. Those tests run my http server in the same process via net/http/httptest. My tests run but I get no coverage. Here is a very simplified example not using http for brevity. Directory layout: $GOPATH/src/go-test hello hello.go itest integration_test.go hello.go package hello func Hello() string { return "hello" } integration_test.go package itest import ( "go-test/hello" "testing" ) func TestHello(t *testing.T) { s := hello

这20个Docker Command,有几个是你会的?

为君一笑 提交于 2020-11-27 08:21:00
这20个Docker Command,有几个是你会的? 收录于话题 #Docker 专辑 9个 点击上方“民工哥Linux运维”,选择“置顶公众号” 有趣有内涵的文章第一时间送达! 在这之前呢,也写过两篇关于Docker基础入门类的文章 Docker容器技术入门(一) Docker容器技术入门(二) 很多人都感觉这文章这么简单、这么基础,可是别忘记了“万丈高楼平地起”,如果少了这个平地址,你这高楼估计也起不了。所以,基础是学习任何一门技术或者一个技术点的重中之重,也可以说是很关键的决胜点。 所以呢,今天,民工哥给大家总结了这20个Docker Command,愿各位小伙伴在通往“玩转Docker”路上不再无助!!!! 安装完成docker容器服务之后,需要了解如何操作它?在shell命令行下直接输入docker就可以查看帮助信息,如下。 [root@master ~]# docker Usage: docker COMMAND A self-sufficient runtime for containers Options: --config string Location of client config files (default "/root/.docker") -D, --debug Enable debug mode --help Print usage -H, -

从普通JAVA程序员到阿里架构师,他用了六年

帅比萌擦擦* 提交于 2020-11-27 05:49:38
工作年限:8 年服务公司:4 家(含四大门户中的两家)最近职业:Java 架构师职场关键词:社交平台、高并发系统架构设计、技术团队管理、多款从零到一的产品城市! 六年间,这位职人呆过四大门户中的两家,完成了工程师到架构师的蜕变。经手多款从零到一产品的开发和增长,也经历国内最大社交平台亿级流量和用户的架构设计及优化工作。工作上思路清晰、认真负责,是同事们心目中优秀 Problem Solver。 问:介绍一下你自己? 答 :我 2008 年硕士毕业后,前 2 年在一家传统 IT 公司,最近 6 年在互联网公司,历任 Java 开发工程师、高级工程师、架构师等职位。工作内容上,经历过多款产品从零到一的诞生开发过程,也经手过国内用户、内容和流量最大的社交/社区产品的架构改造优化工作,有丰富的社交产品的研发经验,目前在一家创业公司担任技术合伙人。 问:你擅长的技术领域是什么? 答 :擅长的编程语言是 Java、Golang、Scala,熟悉程度依次递减。专注于高性能、高并发系统架构设计和实现。 问:平时怎么向家人解释你的工作是做什么的? 答 :一般不详细解释,即使解释了也是徒劳。所以他们会按照自己的理解来描述我的工作,比如修电脑的,比如卖手机的。 问:你觉得程序员可以当一辈子吗?有没有想象过自己 40 岁时在做什么? 答 :应该还是会从事开发方面的工作吧,外企中有很多上了年岁的程序员啊。

流量防卫兵|Sentinel go 阿里双11 同款

人走茶凉 提交于 2020-11-27 05:47:08
作者 | 于雨 apache/dubbo-go 项目负责人 本文作者系 apache/dubbo-go 项目负责人,目前在 dubbogo 项目中已内置可用 sentinel-go,如果想单独使用可参考 [在 dubbo-go 中使用 sentinel] 一文,若有其他疑问可进 dubbogo 社区【钉钉群 23331795】进行沟通。 导读: 本文主要分析阿里巴巴集团开源的流量控制中间件 Sentinel,其原生支持了 Java/Go/C++ 等多种语言,本文仅仅分析其 Go 语言实现。下文如无特殊说明,sentinel 指代 Sentinel-Go。 基本概念 Resource 和 Rule 1. Resource // ResourceType represents classification of the resources type ResourceType int32 const ( ResTypeCommon ResourceType = iota ResTypeWeb ResTypeRPC ) // TrafficType describes the traffic type: Inbound or Outbound type TrafficType int32 const ( // Inbound represents the inbound traffic

VsCode快捷键

泪湿孤枕 提交于 2020-11-27 05:22:13
[TOC] 常用 General 按 Press 功能 Function Ctrl + Shift + P,F1 显示命令面板 Show Command Palette Ctrl + P 快速打开 Quick Open Ctrl + Shift + N 新窗口/实例 New window/instance Ctrl + Shift + W 关闭窗口/实例 Close window/instance 基础编辑 Basic editing 按 Press 功能 Function Ctrl+X 剪切行(空选定) Cut line (empty selection) Ctrl+C 复制行(空选定)Copy line (empty selection) Alt+ ↑ / ↓ 向上/向下移动行 Move line up/down Shift+Alt + ↓ / ↑ 向上/向下复制行 Copy line up/down Ctrl+Shift+K 删除行 Delete line Ctrl+Enter 在下面插入行 Insert line below Ctrl+Shift+Enter 在上面插入行 Insert line above Ctrl+Shift+\ 跳到匹配的括号 Jump to matching bracket Ctrl+] / [ 缩进/缩进行 Indent/outdent line

How to check whether current local time is DST?

霸气de小男生 提交于 2020-11-27 05:16:11
问题 In Ruby, for example, there's the Time#dst? function, which returns true in the case it is daylight saving time. Is there a Go standard library API call to do the same? 回答1: The Location api doesn't export the DST value of the timezone. This was brought up in the golang-nuts forum several years ago. One suggestion is to compare the January 1 timezone offset to the July 1 timezone offset. A working solution of this was posted using this method. One caveat is that goplay has the wrong local

How to check whether current local time is DST?

这一生的挚爱 提交于 2020-11-27 05:07:05
问题 In Ruby, for example, there's the Time#dst? function, which returns true in the case it is daylight saving time. Is there a Go standard library API call to do the same? 回答1: The Location api doesn't export the DST value of the timezone. This was brought up in the golang-nuts forum several years ago. One suggestion is to compare the January 1 timezone offset to the July 1 timezone offset. A working solution of this was posted using this method. One caveat is that goplay has the wrong local

How to check whether current local time is DST?

帅比萌擦擦* 提交于 2020-11-27 05:05:47
问题 In Ruby, for example, there's the Time#dst? function, which returns true in the case it is daylight saving time. Is there a Go standard library API call to do the same? 回答1: The Location api doesn't export the DST value of the timezone. This was brought up in the golang-nuts forum several years ago. One suggestion is to compare the January 1 timezone offset to the July 1 timezone offset. A working solution of this was posted using this method. One caveat is that goplay has the wrong local

How to check whether current local time is DST?

﹥>﹥吖頭↗ 提交于 2020-11-27 05:05:29
问题 In Ruby, for example, there's the Time#dst? function, which returns true in the case it is daylight saving time. Is there a Go standard library API call to do the same? 回答1: The Location api doesn't export the DST value of the timezone. This was brought up in the golang-nuts forum several years ago. One suggestion is to compare the January 1 timezone offset to the July 1 timezone offset. A working solution of this was posted using this method. One caveat is that goplay has the wrong local

vsCode 快捷键

一个人想着一个人 提交于 2020-11-27 04:53:38
记住常用的快捷键,对开发来说,简直是行云流水,心里无比顺畅。 按 Press 功能 Function Ctrl + Shift + P,F1 显示命令面板 Show Command Palette Ctrl + P 快速打开 Quick Open Ctrl + Shift + N 新窗口/实例 New window/instance Ctrl + Shift + W 关闭窗口/实例 Close window/instance 基础编辑 Basic editing 按 Press 功能 Function Ctrl+X 剪切行(空选定) Cut line (empty selection) Ctrl+C 复制行(空选定)Copy line (empty selection) Alt+ ↑ / ↓ 向上/向下移动行 Move line up/down Shift+Alt + ↓ / ↑ 向上/向下复制行 Copy line up/down Ctrl+Shift+K 删除行 Delete line Ctrl+Enter 在下面插入行 Insert line below Ctrl+Shift+Enter 在上面插入行 Insert line above Ctrl+Shift+\ 跳到匹配的括号 Jump to matching bracket Ctrl+] / [ 缩进/缩进行 Indent