tanka icon indicating copy to clipboard operation
tanka copied to clipboard

tk lint problems

Open strowi opened this issue 2 years ago • 1 comments

Hi,

not really sure if this is a linter problem or if i am still doing sth. wrong (tk show/apply works without a problem). It seems to have a problem with std.get.

~> tk --version
tk version v0.22.1

~> tk lint lib/grafana
/tmp/tanka/lib/grafana/grafana-ini.libsonnet:15:26-33 Indexed object has no field "get"

          instance_name: std.get(instance, 'name', default='dashboard.' + config.ingress.realm + '.' + config.ingress.tld + '/' + instance.handle),

~> cat /tmp/tanka/lib/grafana/grafana-ini.libsonnet
{
  datasourcesFile(config, instance):: {
    'datasources.yml': std.manifestYamlDoc(
      {
        apiVersion: 1,
        datasources: instance.datasources,
      }
    ),
  },
  iniFile(config, instance):: {
    'grafana.ini': std.manifestIni(
      {
        main: {
          app_mode: 'production',
          instance_name: std.get(instance, 'name', default='dashboard.' + config.ingress.realm + '.' + config.ingress.tld + '/' + instance.handle),
        },
....

regards,
strowi

strowi avatar Aug 24 '22 14:08 strowi

It's an issue upstream. The get function is new and it's missing from the linter map: https://github.com/google/go-jsonnet/blob/master/linter/internal/types/stdlib.go#L22-L172

julienduchesne avatar Aug 24 '22 14:08 julienduchesne

Upstream issue: https://github.com/google/go-jsonnet/issues/626 and PR that implements support for it: https://github.com/google/go-jsonnet/pull/627

jvrplmlmn avatar Oct 05 '22 10:10 jvrplmlmn

Fixed with the update to 0.19.1: https://github.com/grafana/tanka/pull/783

julienduchesne avatar Dec 19 '22 14:12 julienduchesne