GithubHelp home page GithubHelp logo

arthurkushman / pgo Goto Github PK

View Code? Open in Web Editor NEW
85.0 7.0 16.0 197 KB

Go library for PHP community with convenient functions

License: MIT License

Go 100.00%
golang go php functions api date files strings html array arrays map maps filters filter ip2long striptags

pgo's Issues

Add GetMxrr to check for MX

	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

Things that don't translate between PHP and Go...

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.