arthurkushman / pgo Goto Github PK
View Code? Open in Web Editor NEWGo library for PHP community with convenient functions
License: MIT License
Go library for PHP community with convenient functions
License: MIT License
mxs, err := net.LookupMX("google.com")
if err != nil {
panic(err)
}
// dig +short google.com mx
for _, mx := range mxs {
fmt.Printf("%s %v\n", mx.Host, mx.Pref)
}
// aspmx.l.google.com. 10
// alt1.aspmx.l.google.com. 20
// alt2.aspmx.l.google.com. 30
// alt3.aspmx.l.google.com. 40
// alt4.aspmx.l.google.com. 50
To let users easily serialize any go code to string and back from string to go code, it is convenient e.g. to store data in db, key-value storages etc
Starting from 1.18.beta1 we have finally generics in Go, to be more productive and rely/transfer functionality to generics
To coincide with trends lib should evolve accordingly.
As someone who has used php since 2002 and go since 2015 (and various other languages in between). There are some very inherient problems with this package that /r/golang pointed out on reddit: https://www.reddit.com/r/golang/comments/aax0ho/terrific_go_library_for_php_community_with/
The list of them and what's wrong...
https://github.com/arthurkushman/pgo/blob/master/core.go#L15
https://github.com/arthurkushman/pgo/blob/master/pdate.go#L25
If you're writing a web app in go, you don't want your route to panic the entire application. This results in the site is down. Error handling does not translate between php and go. You have to just handle your errors.
https://github.com/arthurkushman/pgo/blob/master/pfiles.go#L23
You're not handling potential type errors that could arise if that isn't an integer.
https://github.com/arthurkushman/pgo/blob/master/pfiles.go#L28
What if your file contents aren't even long enough for this?
https://github.com/arthurkushman/pgo/blob/master/pstr.go#L16
... variable name is variable type, rename that var...
A lot of what you're doing is great for learning from a php background to get into golang, but I wouldn't run any of this in production.
Because of soon deprecation of package ioutil in Go - see: https://www.srcbeat.com/2021/01/golang-ioutil-deprecated/
It needs to be changed in lines:
Line 123 in 2c2f171
Line 157 in 2c2f171
Line 33 in 2c2f171
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.