Coder Social home page Coder Social logo

Comments (4)

jfcg avatar jfcg commented on May 24, 2024 1

I have run into this problem myself. Here is the solution I've found:

  • go test -c -o myTest
  • VS Code > Run and Debug > create a launch.json file > "Go" from drop down menu > Go: Launch Package
  • Inside .vscode/launch.json, update as "name": "My Test", "mode": "exec" and "program": "./myTest"
  • You can give -test.run regex argument to ./myTest to run specific test(s)
  • Run and Debug > Green play button will run/debug ./myTest

I dont really know why compiling the test exec first works.

Cheers..

from sorty.

mariotoffia avatar mariotoffia commented on May 24, 2024

Thanks!! :)

from sorty.

s0xzwasd avatar s0xzwasd commented on May 24, 2024

Same issue in GoLand (2023.3.2) and Go 1.21.6 where you cannot change mode to exec.

Workaround is to use Attach to Process with time.Sleep() but it's requires additional setup and not very straightforward.

package somepackage

import (
	"github.com/mariotoffia/goannoy/builder"
	"testing"
	"time"
)

func Test_IncludeGoAnnoy(t *testing.T) {
	builder := builder.Index[float32, uint32]().
		AngularDistance(255).
		UseMultiWorkerPolicy().
		MmapIndexAllocator().
		Build()
	time.Sleep(time.Second * 15) // set time
	builder.Close() // set breakpoint
}
  • Set time, run test as usual (not debugging).
  • Invoke Run | Attach to Process in the main menu.
  • Select a test process (not go test or test2json)
SCR-20240123-idno

@jfcg Could you please take a look? It seems that -gcflags all=-N -l + //go:nosplit directive causes this issue in 1.19.* and lower: golang/go#54291

golang/go#54291 (comment)

from sorty.

jfcg avatar jfcg commented on May 24, 2024

Hi,
For sorty's core use case, removing stack check & preventing preemption (especially at leaf functions) are important for performance. So go:nosplit directives need to stay. There is a solution working for VSCode, so maybe you could consider

  • adding "mode": "exec" launch configuration to GoLand IDE (mid to long term)
  • vendoring sorty and removing some go:nosplits for getting past your debug compilation errors (short term)

Cheers..

from sorty.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.