Skip to content

Golang port#85

Draft
egandro wants to merge 10 commits intoWebReflection:mainfrom
egandro:golang-port
Draft

Golang port#85
egandro wants to merge 10 commits intoWebReflection:mainfrom
egandro:golang-port

Conversation

@egandro
Copy link

@egandro egandro commented Feb 13, 2026

I finally finished my golang port.

Please test.

@coveralls
Copy link

coveralls commented Feb 13, 2026

Pull Request Test Coverage Report for Build 22369624294

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 15261346947: 0.0%
Covered Lines: 125
Relevant Lines: 125

💛 - Coveralls

@WebReflection
Copy link
Owner

this looks awesome to me ... but I ain't go expert, although I cannot spot anything obviously wrong with it ... are you confident this is going to play well between Go and others PLs too? That's my only concern, as in: it should be able to serialize correctly for Python/JS/PHP too, it should be able to deserialize from those PLs ... can we maybe automate such test based on the same test you do for identity preserved over "roundtrips"?

Anyway, thanks a lot and let's ship it sooner than later 🥳

@egandro
Copy link
Author

egandro commented Feb 14, 2026

Sure.

  1. We need (more sane) test cases.
  2. Let's use jq to format them
  3. Let's add sha256 checksums to them

Then we can compare input/output in all implementations

@WebReflection
Copy link
Owner

I think we can create a reference file without spaces and use it to roundtrip back and forward and if the outcome is identical we’ll be good?

just trying to keep it as simple as possible

@egandro
Copy link
Author

egandro commented Feb 14, 2026

Yes a reference file would be great.

We can also download some external very nested json and use them for testing during ci/cd.

Let me add a cli to the go project real quick and I past some code here.

@egandro
Copy link
Author

egandro commented Feb 14, 2026

  1. i create a flatten cli that works similar to gzip
  2. have a look at the toplevel test-dummy.sh file it makes sha256 tests on a normalized json files (spaces, keys sorted)

I think if we do this for all php, js, ... version to have expected sha256 inputs and outputs we ensure compatibility.

(let's get rid of the test-dummy.sh - i would love to just have a tests.json)

[
  { 
    "file": "file://tests/foo.json",
    "normal_sha256": "....",
    "flattened_sha256": "...."
  },
  { 
    "file": "https:://somewhere/extenal/foo.json,
    "normal_sha256": "....",
    "flattened_sha256": "...."
  }
]

And ever version needs to run this as integration.

@egandro
Copy link
Author

egandro commented Feb 20, 2026

Any news here? Are we good to go?

@WebReflection
Copy link
Owner

@egandro I was snowboarding last week, sorry for the delay ... let's try to fix CI and then move forward? currently failing

@egandro
Copy link
Author

egandro commented Feb 24, 2026

@egandro I was snowboarding last week, sorry for the delay ... let's try to fix CI and then move forward? currently failing

I have no idea why this is happening 🤷

 apt-get update && apt-get install -y jq make
Reading package lists...
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

@egandro
Copy link
Author

egandro commented Feb 24, 2026

I added sudo - please test

@WebReflection
Copy link
Owner

@egandro some kind of progress:

image

@egandro
Copy link
Author

egandro commented Feb 24, 2026

Sorry - I added super strict Linter/Security checks.

@egandro egandro marked this pull request as draft February 24, 2026 20:54
@egandro
Copy link
Author

egandro commented Feb 24, 2026

I made this a draft since we have to get rid of test-dummy.sh.

@WebReflection
Copy link
Owner

@egandro we're here:

Golang errors in file: [/github/workspace/golang/main.go]:

  > [line 11 : column 2] - could not import github.com/WebReflection/flatted/golang/pkg/flatted (invalid package name: "")

@egandro
Copy link
Author

egandro commented Feb 24, 2026

Yeah this is because we have an additional sub dir. Fixed

@WebReflection
Copy link
Owner

we should be good as soon as coverall comes back 👍

@egandro
Copy link
Author

egandro commented Feb 25, 2026

This is the interesting part.

I would love to have a test like this for every implementation using the same checksums.

Run bash ./test-dummy.sh
Building flatted binary...
go build -o flatted main.go
Verifying checksum for test/65518.json...
Checksum verified successfully.
Flattening test/65518.json and verifying output...
Output checksum verified successfully.
Unflattening and verifying round-trip integrity...
Round-trip verification successful.

@WebReflection
Copy link
Owner

@egandro to have that we need a reference file to parse and re-write (elsewhere) to then check its checksum but I think that could be a follow up ... I've no idea what's going on with coveralls, it's a 530 response even after re-running it, pretty weird ... I have a special coverall entry in my package.json, please double check your yaml is doing the same and let's have coverage sorted? Then I'll merge and publish!

@WebReflection
Copy link
Owner

actually ... https://coveralls.io/ is fully down, nothing to do with this MR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants