diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e540363..17c4a94e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. - Add the "Last Duration" field in the "My Checks" page (#257) - Add "last_duration" attribute to the Check API resource (#257) - Upgrade to psycopg2 2.8.3 +- Add Go usage example ### Bug Fixes - Usernames now are uuid3(const, email). Prevents multiple accts with same email (#290) diff --git a/hc/front/management/commands/pygmentize.py b/hc/front/management/commands/pygmentize.py index 9f8ce124..4ae89f96 100644 --- a/hc/front/management/commands/pygmentize.py +++ b/hc/front/management/commands/pygmentize.py @@ -34,6 +34,7 @@ class Command(BaseCommand): _process("crontab", lexers.BashLexer()) _process("cs", lexers.CSharpLexer()) _process("node", lexers.JavascriptLexer()) + _process("go", lexers.GoLexer()) _process("python_urllib2", lexers.PythonLexer()) _process("python_requests", lexers.PythonLexer()) _process("python_requests_fail", lexers.PythonLexer()) diff --git a/templates/front/show_usage_modal.html b/templates/front/show_usage_modal.html index ce4cf955..9a115ea2 100644 --- a/templates/front/show_usage_modal.html +++ b/templates/front/show_usage_modal.html @@ -20,6 +20,9 @@ + @@ -57,6 +60,9 @@
{% include "front/snippets/node.html" %}
+
+ {% include "front/snippets/go.html" %} +
{% include "front/snippets/php.html" %}
diff --git a/templates/front/snippets/go.html b/templates/front/snippets/go.html index 83d9f599..b0d4ae51 100644 --- a/templates/front/snippets/go.html +++ b/templates/front/snippets/go.html @@ -1,4 +1,12 @@ -
import "net/http"
-import "fmt"
-func main() { _, err := http.Head("PING_URL") }
+
package main
+
+import "fmt"
+import "net/http"
+
+func main() {
+	_, err := http.Head("{{ ping_url }}")
+	if err != nil {
+		fmt.Printf("%s", err)
+	}
+}
 
diff --git a/templates/front/snippets/go.txt b/templates/front/snippets/go.txt index 4b1c1bc0..e3213a48 100644 --- a/templates/front/snippets/go.txt +++ b/templates/front/snippets/go.txt @@ -1,3 +1,5 @@ +package main + import "fmt" import "net/http" diff --git a/templates/front/welcome.html b/templates/front/welcome.html index 1ec27d4c..0fa71037 100644 --- a/templates/front/welcome.html +++ b/templates/front/welcome.html @@ -99,6 +99,9 @@
{% include "front/snippets/node.html" %}
+
+ {% include "front/snippets/go.html" %} +
{% include "front/snippets/php.html" %}
@@ -334,7 +337,7 @@

Apprise
Push Notifications

- {% endif %} + {% endif %} {% if enable_discord %}
@@ -343,8 +346,8 @@

Discord
Chat

- {% endif %} - + {% endif %} + {% if enable_matrix %}
@@ -353,13 +356,13 @@
{% endif %} - +
Mattermost icon

Mattermost
Chat

-
+
@@ -382,14 +385,14 @@ Pager Team icon

Pager Team
Incident Management

-
+
PagerTree icon

PagerTree
Incident Management

-
+ {% if enable_pushbullet %}
@@ -399,7 +402,7 @@
{% endif %} - + {% if enable_pushover %}
@@ -441,7 +444,7 @@ VictorOps icon

VictorOps
Incident Management

-
+ {% if enable_whatsapp %}