hashicorp / hashicorp/hcl

Error formatting can result in "<nil>" in output

Open
#399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.8k
Forks
659
Avg merge
20h 36m
Merged PRs (30d)
6

Description

The conversion of a Diagnostic to an error string assumes a meaningful subject: https://github.com/hashicorp/hcl/blob/90676d47a0ce038f02596e2aa5894bf0c57fad56/diagnostic.go#L77

In practice I'm seeing errors such as <nil>: Configuration file not found; The configuration file foo.hcl does not exist. which are a bit ugly. Should the inclusion of Subject be conditional, or would that cause issues by breaking the current X:Y structure?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in diagnostic.go at the Diagnostic-to-error-string conversion linked in the issue. Inspect how Subject is formatted and check whether existing behavior depends on the current X:Y structure; done means errors without a meaningful Subject no longer contain while the existing formatting remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.