Skip to content

Conversation

@nitram509
Copy link
Contributor

Hi,

this is a great lib. While tinkering around, I found two issues, I would like to share/improve.
This PR covers two aspects.

  • with Go 1.18, the js.Wrapper is no more available, so i removed it. See https://tip.golang.org/doc/go1.18
  • for type time.Time, a "new Date" object in JS is created.

Any feedback is welcome.

go.mod Outdated

go 1.16

require github.com/corbym/gocrest v1.0.5 // indirect
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this test dependency.

Copy link
Contributor Author

@nitram509 nitram509 Nov 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to remove this one - it would break the provided test below.
I guess we're talking about introducing a new dependency here?
I'm sorry I forgot to mention it in the main description.
May I propose adding this Gocrest library, as it significantly improves the readability of tests.
Here's an example

then.AssertThat(testing, "hi", is.EqualTo("bye").Reason("we are going"))

that's way more expressive, compare to the vanilla Golang style of writing if ... then t.fail()...

What do you think?
Would it be ok to leave the test as is?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library is simple enough to have zero dependencies. I'll look into updating your tests if you like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for answering.

Well, from engineer to engineer, I can't agree on "This library is simple enough to have zero dependencies."
Since this is a "test only" dependency and test-support libraries like this have the tendency to be stable over a long period of time. The major benefit I see is improved expressiveness when reading tests.
Hence, I consider the value of following the clean code principle is the stronger goal,
in relation to zero dependencies (as in all dependencies).
(just my 2cents)

That said, this is your lib, and you have the last word about the goals and the non-goals of this lib.

If you wish, I can rework towards "vanilla go" and remove the dependency as well, or you do this ... as you wish.

Happy to chat further, if you want :)

@norunners
Copy link
Owner

Thank you for the contribution.

…arnings:

"Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/setup-go@v2, actions/checkout@v2"
remove former empty line to trigger Github Action
@nitram509
Copy link
Contributor Author

Hi @norunners
I did refactor the code into the valueOfStruct() function, as you requested.

Additionally, I did fix the Github workflow, because of the warnings (see the screenshot attached).

May I ask, how you think about the test library 'gocrest' used? (see my previous comment)

Screenshot 2022-11-19 at 14 21 57

Co-authored-by: Caleb Jasik <calebjasik@jasik.xyz>
@jasikpark
Copy link

would it be possible to split this PR into multiple? one fixing go 1.18 support && one adding the testing library w/ nice helpers?

@nitram509
Copy link
Contributor Author

@jasikpark @norunners I did my best in splitting this PR into three separate ones #18 #19 and #20.
So I close this one.

@nitram509 nitram509 closed this Nov 30, 2022
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