小编jon*_*zza的帖子

忽略Golang测试覆盖率计算中的代码块

我正在为golang代码编写单元测试,并且在计算覆盖率时,我希望忽略几种方法.这可能吗?如果是这样,怎么样?

unit-testing code-coverage go

23
推荐指数
1
解决办法
6572
查看次数

Golang中TLS连接的问题

我有以下证书层次结构:

根 - > CA - > 3叶证书

整个链都有serverAuth和clientAuth作为显式定义的扩展密钥用法.

在我的go代码中,我创建了一个tls.Config对象,如下所示:

func parseCert(certFile, keyFile string) (cert tls.Certificate, err error) {
    certPEMBlock , err := ioutil.ReadFile(certFile)
    if err != nil {
        return
    }
    var certDERBlock *pem.Block
    for {
        certDERBlock, certPEMBlock = pem.Decode(certPEMBlock)
        if certDERBlock == nil {
            break
        }
        if certDERBlock.Type == "CERTIFICATE" {
            cert.Certificate = append(cert.Certificate, certDERBlock.Bytes)
        }
    }

    // Need to flip the array because openssl gives it to us in the opposite format than golang tls expects.
    cpy := …
Run Code Online (Sandbox Code Playgroud)

ssl https certificate ssl-certificate go

8
推荐指数
1
解决办法
5153
查看次数

UnsatisfiedLinkError Libgdx桌面

我在桌面上遇到LibGDX的问题.尝试启动应用程序时,我不断收到以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(I)Ljava/nio/ByteBuffer;
at com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(Native Method)
at com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(BufferUtils.java:288)
at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:62)
at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:53)
at com.badlogic.gdx.graphics.Mesh.<init>(Mesh.java:148)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:173)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:142)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:121)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:115)
Run Code Online (Sandbox Code Playgroud)

我在项目中添加了以下库:

  • gdx.jar
  • GDX-sources.jar
  • GDX-natives.jar
  • GDX-后端,lwjgl.jar
  • GDX-后端-LWJGL-natives.jar

我错过了什么吗?

我已经搜索过高低,但我找到的所有内容都是针对Android并且告诉我将.so库从arm文件夹添加到我的项目中,但这对我来说对于wintel平台上的桌面项目没有意义.

java java-native-interface libgdx unsatisfiedlinkerror

5
推荐指数
1
解决办法
4751
查看次数