Copying code without including the dependency - is it unethical?

You are only wrong if you are using this code for anything other than personal projects that you will never release to the public.

If you are releasing these projects to the public, the ethics behind it solely depend on the license of the code you are pulling from. The license of the code shows how the creator intends for their code to be used. If you go against these intentions, you are going against the creator of the code. You might not actually be going against these license, but by not even checking them shows serve negligence on your part.

Most authors simply want an acknowledgement for their work, which is not hard to do. You not even caring to see what their licenses say is just disrespectful.

A friend suggested that I'm not crediting the original author and that I should include the dependency instead, because they get credit then.

It doesn't matter if you use the whole dependency or just parts of the code. If you did not write it, the code should be handled in the way that the licensor intends for it to be. Using part of the code does not get around this.

I'm happy to include a "I copied this from github/someone/project" comment (and often do, so I know where I got it from), but I rarely open-source my code, so no-one is going to read it and it seems a bit pointless.

It doesn't matter what you do with it. If you turn in someone else's homework, you are cheating.

I'm really hoping you don't do this for work. If you do, you are possibly opening your employer up to a lot of legal issues.

/r/golang Thread