Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement io.Reader, io.Writer for quote database #8

Merged
merged 4 commits into from
Dec 22, 2023

Conversation

servusdei2018
Copy link
Contributor

Refactored quoteFile into an io.Reader and io.Writer interface at the quotes.go level. Additionally, the logic in theory.go was simplified to reduce allocations by eliminating the variable sentence. A multi-stage Dockerfile was also introduced, resulting in a final stage image that is ~8% of its original size.

Two notes regarding the Dockerfile:

  • if any CGO-requiring dependency is introduced, the image gcr.io/distroless/static-debian12 should be switched to gcr.io/distroless/base-debian12 so that the image includes the appropriate glibc shared objects
  • if spatial optimization is of utmost concern, go build may be switched to go build -ldflags="-s -w" in order to strip the DWARF tables and symbol table. This will result in a smaller binary at the cost of being able to debug the binary with gdb or delve

@Alextopher Alextopher self-assigned this Dec 21, 2023
@Alextopher Alextopher linked an issue Dec 21, 2023 that may be closed by this pull request
Copy link
Collaborator

@Alextopher Alextopher left a comment

Choose a reason for hiding this comment

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

Great progress! I think this will support further testing. I will run this in production for the day and merge tomorrow.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
@bashawhm
Copy link
Owner

Looks good to me! I don't know docker, but all the Go changes seem good :)

@Alextopher Alextopher merged commit 9c4229e into bashawhm:main Dec 22, 2023
4 checks passed
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.

Use io.Reader/io.Writer interfaces to back the qoute database
3 participants