Friday, April 12, 2024
HomeGolangGolang Constructing from Supply - Getting Assist

Golang Constructing from Supply – Getting Assist

I’ve been engaged on a analysis undertaking that entails Rubbish assortment mechanisms in Golang. We’ve efficiently constructed Golang from supply code. Now, we try so as to add minor modifications within the supply code and see if construct succeeds or not. As a starter, we now have added a log print in mgc.go file in perform gcinit on the very starting

func gcinit() {
	log.Print("In Operate GCINT ")

After including the log print, the construct fails with the next error:

In Operate GCINIT 
            In Operate GCINIT shift.go:12:6: (i8 + 1) (8 bits) too small for shift of 8
FAIL    cmd/vet    9.460s
go software dist: Failed: exit standing 1

We’ve tried to make use of fmt.printf however no luck to this point. We might be completely satisfied if somebody may help

Hello @jaintapauljp,

I may think about that the fmt bundle causes issues.

Did you attempt the built-in print or println features?

Hello @christophberger , thanks for the suggestion. It nonetheless fails with the next message:

  --- FAIL: TestVet/rangeloop (0.46s)
        vet_test.go:146: error verify failed: 
            Unmatched Errors:

The errors seem to return from operating go check on the sources of the vet command.

I can’t see any connection between mgc.go that you just modified and the information shift.go and vet_test.go that belong to the unit exams for the vet command.

Do I perceive the state of affairs appropriately: the rangeloop check fails reproducibly in the event you add a name to the built-in perform println() to func gcinit() in runtime/mgc.go?

All else is vanilla code?

You might be proper about the issue. We solely added a line within the gcinit perform and that causes the fail. If we take away the road, the construct works wonderful.

I received curious and put in the Go supply following the steps in Putting in Go from supply – The Go Programming Language.

Then I modified src/runtime/mgc.go to incorporate the println name:

 func gcinit() {
	// remainder of gcinit

Then I ran ./all.bash within the goroot listing. The compilation succeeded.

The primary check that fails is:

okay  	regexp/syntax	1.042s
--- FAIL: TestLockRankGenerated (0.15s)
    lockrank_test.go:20: exit standing 1
--- FAIL: TestSUID (0.11s)
    crash_test.go:138: operating go construct -o /var/folders/_m/dgnkqt8d3j10svk5c06px4vc0000gn/T/go-build2564578370/testsuid.exe
    security_test.go:82: constructing testsuid []: exit standing 1
        # runtime
        ../../mgc.go:153:13: newline in string
        ../../mgc.go:153:13: syntax error: surprising newline in argument listing; probably lacking comma or )
        ../../mgc.go:154:2: syntax error: surprising if at finish of assertion

Different exams fail in these methods:

--- FAIL: TestTrampoline (1.00s)
    link_test.go:690: surprising output (default):
        good day
--- FAIL: TestRuntimeTypeAttrInternal (0.77s)
    dwarf_test.go:776: couldn't parse kind tackle from program output "GCINITn4311591584": strconv.ParseUint: parsing "GCINITn4311591584": invalid syntax
--- FAIL: TestHello (27.07s)
    pack_test.go:221: incorrect output: "GCINITnhello worldn", need "good day worldn"

It seems to be just like the in the beginning drawback is that print / println messes with stdout.

Please let me know in the event you discover a answer for this state of affairs. I’m actually caught with this.

All I can inform proper now could be that any perform that writes to stdout (and doubtless stderr, too) invalidates a number of exams.

I’ve to take a guess, however the file debuglog.go (in src/runtime) seems to be fascinating. It supplies an in-memory debugger. When the app panics, the log output will get written to stdout.

From the file feedback, evidently debuglog.go is right for logging exercise contained in the runtime:

dlog can be utilized from highly-constrained corners of the runtime: it’s secure to make use of within the sign handler, from inside the write barrier, from inside the stack implementation, and in locations that have to be recursively nosplit.

Thanks. I’ll attempt to use it as per your suggestion. I’ll let you realize if that works for me.

1 Like

Are you able to specify the steps to breed? I wish to construct it from supply as nicely…appears intriguing

Hello , I attempted to make use of the debuglog however but I failed.

@jaintapauljp sorry for the late reply. I’m afraid I ran out of concepts. Utilizing debuglog was a fast thought drawn from wanting on the sources. Possibly somebody who’s skilled with constructing Go from supply may help additional.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments