Aceternity UI has some bugs in few components I used. like for example the Card-with-hover-effect takes array of objects with title, description and link property. then uses the link prop for the key. if you have an object with the same link prop, it throws an error. since it has hover event, there will be lots of console errors which isn't good for the overall performance. instead, they can use the index of the object being mapped as the key since the index is always unique in this context. other bugs i noticed is, some components have
validDOMNesting warning, meaning for instance <h1> or <h2> cannot appear as a descendant of <p> or <h3>.π2
A little copying is better than a little dependency.
this is actually one of the wisdom words from Rob Pike (one of Golang's creator). it is all about simplicity vs. reusability. still a dependency is crucial but sometimes dependencies pose some risks like:
Increased build times: Larger projects take longer to compile.
Introducing security vulnerabilities: Outdated or compromised libraries pose risks.
Make your code harder to understand: You might not know how the library works internally.
In Go's minimalist philosophy, sometimes a few lines of copied code are easier to manage than a complex external library. This is especially true for small, self-contained functions or utility code.
Weigh the benefits of reusing code against the potential downsides of adding dependencies. In Go, simplicity often wins! that is why something like generics weren't supported till Go's version 1.2
#tips #golang
π₯2
in Go, to format Error strings use fmt.Errorf or fmt.Sprintf to create error strings that are clear, concise, and informative. Include relevant details, such as the operation that failed or the specific values involved.
handling errors properly really saves debugging times
#tips #golang
func openFile(filename string) (io.Reader, error) {
file, err := os.Open(filename)
if err != nil {
return nil, fmt.Errorf("failed to open file %s: %w", filename, err) // Wrap the error with context
}
return file, nil
}handling errors properly really saves debugging times
#tips #golang
A sniperβs dream FINAL VERSION || Khapiter.boy.s
MegaSaverBot
here's the full version of the song btw πΏ AI song artists be rocking
π1
A constant struggle, a ceaseless battle to bring success from inhospitable surroundings, is the price of all great achievements.
have a great day y'all βοΈ
β€1
ForwardingServiceRepositoryImpl (Archive)
She did it
ofc congrats to Jo. this guy is the reason i started a channel. he and @gugutlogs finally made it π
π₯11
hey mates π so i've been working on a site where anyone can learn and reference Golang materials. Here's the site link:
https://gopher-notes.netlify.app/
Gopher Notes is an archive of Go notes from different resources. I reviewed and edited each part so that the material is up-to-date.
Features:
- Clear and Concise Notes: so you actually retain the info (no more forgetting what a 'defer' statement does lol)
- Exercises that'll test your coding skills
- Bookmark Feature that'll let you bookmark any topic
- Wrapping Up Sections: Additionally, I included this section for every topic that is covered.
If you're starting out in Go or want quick references, check it out. Plus it's totally open-source (giving it a star is appreciated lol). Let's build some awesome Go stuff together! π
[GitHub Repo]
#MyProjects #GopherNotes #golang #resources
https://gopher-notes.netlify.app/
Gopher Notes is an archive of Go notes from different resources. I reviewed and edited each part so that the material is up-to-date.
Features:
- Clear and Concise Notes: so you actually retain the info (no more forgetting what a 'defer' statement does lol)
- Exercises that'll test your coding skills
- Bookmark Feature that'll let you bookmark any topic
- Wrapping Up Sections: Additionally, I included this section for every topic that is covered.
If you're starting out in Go or want quick references, check it out. Plus it's totally open-source (giving it a star is appreciated lol). Let's build some awesome Go stuff together! π
[GitHub Repo]
#MyProjects #GopherNotes #golang #resources
π₯27π2
Mira
hey mates π so i've been working on a site where anyone can learn and reference Golang materials. Here's the site link: https://gopher-notes.netlify.app/ Gopher Notes is an archive of Go notes from different resources. I reviewed and edited each part soβ¦
the bandwidth usage literally sky-rocketed π₯ glad that it turned out to be useful for people
π₯4
make nested conditionals one-dimensional! use early returns from a function rather than if/else chains. this is essential not only in the aspect of Go, but also in any language.
take a look at the following code snippet:
the above code adds cognitive load for someone who's reading ur code (the number of entities they need to think about is a lot, so they might be lost in ur code).
but take a look at the more idiomatic approach to the code:
it uses early returns (guard clauses) and provide a linear approach to logic trees
#tips #code
@Mi_Ra_Ch
take a look at the following code snippet:
func isValidPassword(password string) bool {
isValid := true
if len(password) < 8 {
isValid = false
} else {
if !containsUppercase(password) {
isValid = false
} else {
if !containsLowercase(password) {
isValid = false
} else {
if !containsNumber(password) {
isValid = false
}
}
}
}
return isValid
}
func containsUppercase(str string) bool {
// ... implementation ...
}
func containsLowercase(str string) bool {
// ... implementation ...
}
func containsNumber(str string) bool {
// ... implementation ...
}the above code adds cognitive load for someone who's reading ur code (the number of entities they need to think about is a lot, so they might be lost in ur code).
but take a look at the more idiomatic approach to the code:
func isValidPassword(password string) bool {
if len(password) < 8 {
return false
}
if !containsUppercase(password) {
return false
}
if !containsLowercase(password) {
return false
}
if !containsNumber(password) {
return false
}
return true
}
func containsUppercase(str string) bool {
// ... implementation ...
}
func containsLowercase(str string) bool {
// ... implementation ...
}
func containsNumber(str string) bool {
// ... implementation ...
}it uses early returns (guard clauses) and provide a linear approach to logic trees
#tips #code
@Mi_Ra_Ch
the JPEG-XL team at Google is teaming up with Firefox to make browsing experience safer and smoother.
why should you care? they're replacing the heavy decoder (100k+ lines of C++) with a lighter one built in Rust. this means faster load times and a more secure experience for all image-heavy sites (especially if you're like me who spends time on image-heavy sites). less bloat, more speedβit's a win a win! hope it gets shipped
#JPEGXL
@Mi_Ra_Ch
why should you care? they're replacing the heavy decoder (100k+ lines of C++) with a lighter one built in Rust. this means faster load times and a more secure experience for all image-heavy sites (especially if you're like me who spends time on image-heavy sites). less bloat, more speedβit's a win a win! hope it gets shipped
#JPEGXL
@Mi_Ra_Ch
ahh internet so bad rn cant even work. gotta be coz of national exam. good luck for everyone tho π
β€4