Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Fix type assertions and remove nolint directives for good #425

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

inancgumus
Copy link
Member

@inancgumus inancgumus commented Jun 30, 2022

This commit properly type-asserts to remove nolint:forcetypeassert directives both from the code and tests.

There are new helpers to reduce code bloat and possible error messages refactoring work:

  • asGojaValue(v): returns v as a goja value or panics.
  • gojaValueToString(v): returns v as string or panics.

Fixes: #417
Related: grafana/k6#4496

@inancgumus inancgumus requested review from imiric and ankur22 June 30, 2022 09:19
@inancgumus inancgumus self-assigned this Jun 30, 2022
@imiric imiric mentioned this pull request Jan 30, 2025
60 tasks
@inancgumus inancgumus requested review from imiric and ankur22 and removed request for imiric and ankur22 June 30, 2022 09:23
common/element_handle.go Outdated Show resolved Hide resolved
common/frame.go Outdated Show resolved Hide resolved
This commit properly type asserts and removes nolint directives. There
are new helpers to reduce code bloat and possible error messages
refactoring work:
+ asGojaValue: returns a given value as a goja value or panics.
+ gojaValueToString: returns a given a value as string or panics.

This commit also refactors tests to remove nolint directives.

Fixes: #417
@inancgumus inancgumus force-pushed the fix/417-panic-goja-conversion branch from efd85b5 to fc34711 Compare June 30, 2022 10:50
@inancgumus inancgumus requested a review from ankur22 June 30, 2022 10:56
common/element_handle.go Show resolved Hide resolved
common/frame.go Show resolved Hide resolved
@inancgumus inancgumus merged commit f6b0363 into main Jul 5, 2022
@inancgumus inancgumus deleted the fix/417-panic-goja-conversion branch July 5, 2022 08:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic: interface conversion: interface is nil, not goja.Value
3 participants