Skip to content

Conversation

@phenpessoa
Copy link
Contributor

We were importing a few libs just because of a single constant value, instead, why not use the value directly?

From https://pkg.go.dev/golang.org/x/net/html/atom Br = 0x202

Copy link
Contributor

@kamilon kamilon left a comment

Choose a reason for hiding this comment

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

Because that is the whole point of libraries. The compiler will do the right thing and only pull in what is actually needed. These atom types will most likely be used more and more as we lean on goquery over regex.

If you really want to remove all these, you can just remove that whole block. It appears that the goquery library is actually adding the \n for us. I left that code in case we found that it doesn't work in some cases as it seemed odd that the library has that side-effect.

@phenpessoa
Copy link
Contributor Author

Because that's the whole point of libraries. It might be one point, but definitely not the whole point.

The compiler will do the right thing and only pull in what is actually needed. But we still need to download all dependencies because of a single constant value.

These atom types will most likely be used more and more as we lean on goquery over regex. Good point! But when it happens, we can always import the package again if needed, but as of now, I can't seem to find a reason to have it.

I don't see why we should remove the whole block though instead of what I did with this PR.

Let me know what you think :)

@kamilon
Copy link
Contributor

kamilon commented Jan 10, 2022

I'm fine with this change going in. I'd request that you put a comment above the const with the link to the doc you linked above. It'll make it easier to understand where we picked a random 0x202 :D

@phenpessoa
Copy link
Contributor Author

Good point! Totally agree.
Will do!

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #44 (2a5e7c4) into main (afdf2d5) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #44   +/-   ##
=======================================
  Coverage   13.25%   13.25%           
=======================================
  Files          13       13           
  Lines        1803     1803           
=======================================
  Hits          239      239           
  Misses       1556     1556           
  Partials        8        8           
Impacted Files Coverage Δ
src/TibiaCharactersCharacterV3.go 82.25% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afdf2d5...2a5e7c4. Read the comment docs.

@tobiasehlert tobiasehlert merged commit f745545 into tibiadata:main Jan 10, 2022
@phenpessoa phenpessoa deleted the dependecies branch February 16, 2022 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants