binwiederhier / ntfy

Send push notifications to your phone or desktop using PUT/POST
https://ntfy.sh
Apache License 2.0
17.77k stars 691 forks source link

GO Client library v1 broken? #952

Closed larscom closed 9 months ago

larscom commented 9 months ago

:lady_beetle: Describe the bug go get heckel.io/ntfy@v1.31.0 doesn't seem to work anymore

:computer: Components impacted GO client library

:bulb: Screenshots and/or logs go: heckel.io/ntfy@v1.31.0: unrecognized import path "heckel.io/ntfy": parse https://heckel.io/ntfy?go-get=1: no go-import meta tags (meta tag heckel.io/ntfy/v2 did not match import path heckel.io/ntfy)

:crystal_ball: Additional context I've tried to find a v2 version but can't seem to find one.

binwiederhier commented 9 months ago

I'm sorry. There was another ticket around naming it /v2 and I tried to get that to work, but now both are broken. Any hits as to how to fix this are appreciated.

binwiederhier commented 9 months ago

My guess is that I have to publish a v2 with the new import pat, which I just did. So I hope it'll be resolved later. But idk.

larscom commented 9 months ago

Your paths seem fine, you didnt make a git tag yet for v2+ which is the problem i think.

larscom commented 9 months ago

My guess is that I have to publish a v2 with the new import pat, which I just did. So I hope it'll be resolved later. But idk.

i think this will solve the problem yes.

binwiederhier commented 9 months ago

It did in fact not solve the problem. I had to actually make two module files. Here's what fixed it:

Old module (v1, at https://heckel.io/ntfy):

heckel.io/ntfy# cat index.html 
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="heckel.io/ntfy git https://github.com/binwiederhier/ntfy">
<meta name="go-source" content="heckel.io/ntfy https://github.com/binwiederhier/ntfy https://github.com/binwiederhier/ntfy/tree/master{/dir} https://github.com/binwiederhier/ntfy/blob/master{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://github.com/binwiederhier/ntfy">
</head>
<body>
<b>ntfy</b>, redirecting to <a href="https://github.com/binwiederhier/ntfy">GitHub</a> ...
</body>
</html>

New module (v2, https://heckel.io/ntfy/v2):

hecke.io/ntfy/v2# cat index.html 
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="heckel.io/ntfy/v2 git https://github.com/binwiederhier/ntfy">
<meta name="go-source" content="heckel.io/ntfy/v2 https://github.com/binwiederhier/ntfy https://github.com/binwiederhier/ntfy/tree/main{/dir} https://github.com/binwiederhier/ntfy/blob/main{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://github.com/binwiederhier/ntfy">
</head>
<body>
<b>ntfy</b>, redirecting to <a href="https://github.com/binwiederhier/ntfy">GitHub</a> ...
</body>
</html>

The -x flag and the GONOPROXY env variable also helped:

GONOPROXY='heckel.io/*' go get -u -x heckel.io/ntfy/v2

Curious: What are you using the lib for? I make no guarantees for the use as a Go lib. The client lib in particular is very rudimentary.

larscom commented 9 months ago

I use it in my go (private) apps, just to send notifications. I could make it myself but its nice to have something that is already ready to use ;)