You are writing a CLI client in Go and your users would love to be able to update this client seamlessly.
I'm talking replacing a currently running executable on UNIX platforms.
// exa.go| /** | |
| * Place this to ./src/scripts/bump-payload.ts | |
| * Then in your package.json add script: | |
| * "bump-payload": "tsx ./src/scripts/bump-payload.ts ./package.json && pnpm i" | |
| * Run `pnpm bump-payload` | |
| */ | |
| import { execSync } from 'child_process'; | |
| import fs from 'fs'; | |
| import path from 'path'; |
You are writing a CLI client in Go and your users would love to be able to update this client seamlessly.
I'm talking replacing a currently running executable on UNIX platforms.
// exa.go| type Thing struct { | |
| Text string | |
| Things []Thing | |
| } | |
| func RootHandler(rw http.ResponseWriter, req *http.Request) { | |
| tmpl, err := template.New("root").Parse(` | |
| <html> | |
| {{ define "message" }} | |
| <li>{{ .Text }} |
| /* MIT License | |
| * | |
| * Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com] | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is | |
| * furnished to do so, subject to the following conditions: |
| # This hosts file is brought to you by Dan Pollock and can be found at | |
| # http://someonewhocares.org/hosts/ | |
| # You are free to copy and distribute this file for non-commercial uses, | |
| # as long the original URL and attribution is included. | |
| #<localhost> | |
| 127.0.0.1 localhost | |
| 127.0.0.1 localhost.localdomain | |
| 255.255.255.255 broadcasthost | |
| ::1 localhost |