#!/usr/bin/env perl
use strict;
use warnings;

my $a = join(" ", @ARGV);
my $cmd = "golint " . $a;
open(my $fh, '-|', $cmd)
  or die "Could not run golint";

my $cnt = 0;
while (my $row = <$fh>) {
  chomp $row;
  if ($row !~ /should have comment or be unexported/) {
    print "$row\n";
    $cnt++;
  }
}

if ($cnt > 0) {
  exit 1;
}
exit 0;
