Skip to content

Missing go.mod in caddy submodule #239

@JaimeValdemoros

Description

@JaimeValdemoros

This is a pretty minor issue so please feel free to close it if you don't think it's worth your time.

Context

The nix/nixpkgs build system provides an integration to build caddy with a list of extensions (using xcaddy or a process like xcaddy under the covers). This lets me write something like the following and get a reproducible build build of caddy with go-pmtiles in just a couple of lines:

# default.nix

{ caddy }:
caddy.withPlugins {
    plugins = [
        "github.com/protomaps/go-pmtiles/caddy@v1.28.0"
    ];
    hash = "sha256-QVyV1PPYqQQnS531BDzp8Equ0le1AzyOHbsCjeOVlew=";
}

Issue

As part of its checks, this integration looks at caddy build-info and checks that all of the requested plugins show up. Unfortunately this check currently isn't working for go-pmtiles because of a mismatch between the requested plugin and the output in build-info (example using xcaddy):

$ xcaddy build --with github.com/protomaps/go-pmtiles/caddy@v1.28.0
$ ./caddy/caddy build-info | grep pmtiles
dep     github.com/protomaps/go-pmtiles v1.28.0 h1:Q23U0DqfVE0PM2ZVcehgZ4yIjd73jcK5UMKcX6K5R3c=

(notice github.com/protomaps/go-pmtiles/caddy vs. github.com/protomaps/go-pmtiles).

I raised NixOS/nixpkgs#430090 as a result to look into it.

Request

@stepbrobd has pointed out this is likely due to a missing go.{mod,sum} under the caddy directory. By way of comparison, building with github.com/darkweak/storages/badger/caddy does show up the full path in caddy build-info:

$ ./result/bin/caddy build-info | grep badger
dep     github.com/darkweak/storages/badger     v0.0.15
dep     github.com/darkweak/storages/badger/caddy       v0.0.15
dep     github.com/dgraph-io/badger/v3  v3.2103.5
build   -tags=nobadger,nomysql,nopgx

This is a link to badger's go.mod: https://github.com/darkweak/storages/blob/main/badger/caddy/go.mod

Would it be feasible to get a go.mod added to the directory so it acts like a proper module? I'm not hugely familiar with go tooling, so I don't know what the impact would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions