Skip to content
Snippets Groups Projects
Select Git revision
  • 2fcb4a9b5606f08209588b79de3f256a6cdd6b5b
  • main default protected
  • drip-server-timing
  • compress-middleware
  • v2.11.0
  • v2.10.0
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.0
  • v2.7.0
  • v2.6.0
  • v2.5.6
  • v2.5.5
  • v2.5.4
  • v2.5.3
  • v2.5.2
  • v2.5.1
  • v2.5.0
  • v2.4.2
  • v2.4.1
  • v2.4.0
  • v2.3.0
  • v2.2.2
24 results

cmd

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Will McCutchen authored
    In #17, we switched to deploying httpbingo.org on Google App Engine. To
    meet their naming requirements, we had to rename cmd/go-httpbin to
    cmd/go_httpbin, but this broke any existing uses of, e.g.,
    
        go get github.com/mccutchen/go-httpbin/cmd/go-httpbin
    
    as suggested in the README and as used in various places (including my
    employer).
    
    Here's a dumb ass fix for that dumb ass problem; I'm not happy about it,
    but it seems to work.
    20dd618a
    History
    Name Last commit Last update
    ..
    go-httpbin
    go_httpbin
    maincmd
    README.md

    What is going on here?

    TL;DR

    • cmd/maincmd package exposes all of this app's command line functionality in a Main()

    • cmd/go-httpbin and cmd/go_httpbin build identical binaries using the maincmd package for backwards compatibility reasons explained below

    Why tho

    Originally, this project exposed only one command:

    cmd/go-httpbin/main.go

    But the dash in that path was incompatible with Google App Engine's naming restrictions, so in moving httpbingo.org onto Google App Engine, that path was (carelessly) renamed to

    cmd/go_httpbin/main.go

    That change had a number of unintended consequences:

    • It broke existing workflows built around go get github.com/mccutchen/go-httpbin/cmd/go-httpbin, as suggested in the README

    • It broke the Makefile, which was still looking for cmd/go-httpbin

    • It broke the absolute aesthetic truth that CLI binaries should use dashes instead of underscores for word separators

    So, to restore the former behavior while maintaining support for deploying to App Engine, the actual main functionality was extracted into the cmd/maincmd package here and shared between the other two.

    (This is pretty dumb, I know, but it seems to work.)